Re: Is there an equivalent to DocumentBuilder for JSON ?
Alan Painter <[email protected]> Thu, 24 Jun 2021 23:19:46 +0200
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <CAN+GtW091eVjgOfqJ=S8QD6xhNs1uaOcAwPy1GbtY6xT9WEOQA@mail.gmail.com> |
With the json-doc function, that is absolutely perfect. Thanks very much! On Thu, Jun 24, 2021 at 11:06 PM Martin Honnen <[email protected]> wrote: > On 24.06.2021 22:56, Martin Honnen wrote: > > >> You can plug into the XdmFunctions for parse-json, however. You will get > >> a map or an array or a string, boolean or number from JSON parsing, not > >> an XdmNode. > > > > Like this: > > > > Processor processor = new Processor(true); > > > > XdmFunctionItem parseJsonFn = > > XdmFunctionItem.getSystemFunction(processor, new > > QName("http://www.w3.org/2005/xpath-functions","parse-json"), 1); > > > > XdmValue input = parseJsonFn.call(processor, new > > XdmAtomicValue("[1, 2, 3]")); > > Or for json-doc: > > XdmFunctionItem jsonDocFn = > XdmFunctionItem.getSystemFunction(processor, new > QName("http://www.w3.org/2005/xpath-functions", "json-doc"), 1); > > XdmValue input2 = jsonDocFn.call(processor, new > XdmAtomicValue("sample.json")); > > > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > [email protected] > https://lists.sourceforge.net/lists/listinfo/saxon-help _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ [email protected] https://lists.sourceforge.net/lists/listinfo/saxon-help