Re: Is there an equivalent to DocumentBuilder for JSON ?
Alan Painter <[email protected]> Thu, 24 Jun 2021 23:01:46 +0200
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <CAN+GtW2zMY6xsAe7KoDVdorMLBQJaoet3kiVFgSi83o1vO2zFA@mail.gmail.com> |
Ah, excellent! Following your previous note, I was just looking at callFunction on XsltTransformer and thinking "I'll have to define a minimal stylesheet" but your solution is much simpler. I'm giving that a shot. thanks very much -alan On Thu, Jun 24, 2021 at 10:57 PM Martin Honnen <[email protected]> wrote: > 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 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ [email protected] https://lists.sourceforge.net/lists/listinfo/saxon-help