227{
228#ifndef EPICS_YAJL_VERSION
229 yajl_parser_config conf;
230 memset(&conf, 0, sizeof(conf));
231 conf.allowComments = 1;
232 conf.checkUTF8 = 1;
233#endif
234
235 std::istringstream strm(txt);
236
237 std::string chanprefix;
238 if(recname) {
239 chanprefix = recname;
240 chanprefix += '.';
241 }
242 context ctxt(chanprefix, result);
243
244#ifndef EPICS_YAJL_VERSION
245 handler handle(yajl_alloc(&conf_cbs, &conf, NULL, &ctxt));
246#else
247 handler handle(yajl_alloc(&conf_cbs, NULL, &ctxt));
248
249 yajl_config(handle, yajl_allow_comments, 1);
250#endif
251
252 if(!pvd::yajl_parse_helper(strm, handle))
253 throw std::runtime_error(ctxt.msg);
254}