Re: Is there an equivalent to DocumentBuilder for JSON ?
Martin Honnen <[email protected]> Thu, 24 Jun 2021 22:56:51 +0200
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Organization | Liberty Development |
| Message-ID | <[email protected]> |
On 24.06.2021 22:38, Martin Honnen wrote:
> On 24.06.2021 22:34, Alan Painter wrote:
>
>> I'm curious if there is the JSON equivalent of DocumentBuilder for
>> constructing XdmNode roots from JSON text documents? Perhaps it's a
>> configuration option of the DocumentBuilder itself?
>
> 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]"));
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help