More detailed result view for XPath/XQuery constructing XML on the fly with e.g. json-to-xml

Issues related to W3C XQuery.
Martin Honnen
Posts: 78
Joined: Tue Aug 19, 2014 12:04 pm

More detailed result view for XPath/XQuery constructing XML on the fly with e.g. json-to-xml

Post by Martin Honnen »

If I have an XML sample containing JSON e.g.

Code: Select all

<root>{
	"key": "val"
}</root>
then, in XPath 3.1 or XQuery 3.1 I can write path expressions constructing XML "on the fly" with e.g. expressions like

Code: Select all

/root/json-to-xml(.)
However, if I do that in the XPath selector input or even in the XPath/XQuery builder and evaluate the expression, the result I get displayed is nothing more like

Code: Select all

Description: #document
XPath location: /
Is there some way to have the result pane show the actual document e.g.

Code: Select all

<map xmlns="http://www.w3.org/2005/xpath-functions"><string key="key">val</string></map>
without using e.g. `!serialize()` additionally in the XPath expression?

I understand the XPath input and XPath/XQuery builder, for paths selecting nodes in the input XML, just highlight the selected nodes in the editor pane so there you can see the visual representation of the result evaluation, but I wonder whether, with XPath 3.1 where we can construct nodes on the fly with json-to-xml and parse-xml/parse-xml-fragment, there shouldn't be some way to see the actually created nodes.
tavy
Posts: 322
Joined: Thu Jul 01, 2004 12:29 pm

Re: More detailed result view for XPath/XQuery constructing XML on the fly with e.g. json-to-xml

Post by tavy »

Hello Martin,

If you select the Saxon XQuery processor in the XPath/XQuery Builder view and run the /root/json-to-xml(.) expression, you will obtain the actual document in the result.
You can also create an XQuery document containing the /root/json-to-xml(.) expression and run it over the XML document.

Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Martin Honnen
Posts: 78
Joined: Tue Aug 19, 2014 12:04 pm

Re: More detailed result view for XPath/XQuery constructing XML on the fly with e.g. json-to-xml

Post by Martin Honnen »

Thanks.
I take it their is currently no way when I do pure XPath (3.1) evaluation?

Of course in the editor it is easy to switch to XQuery but then of course one might write some non XPath expressions in the editor without necessarily noticing while wanting to "develop" some XPath code you later want to feed to a pure XPath API.

Perhaps you can add a feature request.
tavy
Posts: 322
Joined: Thu Jul 01, 2004 12:29 pm

Re: More detailed result view for XPath/XQuery constructing XML on the fly with e.g. json-to-xml

Post by tavy »

Hi Martin,

I added an issue on our issue tracker to analyze this situation better. When the issue will be solved we will update this thread.
Thanks again for the feedback.

Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply