xsl-list
[Top] [All Lists]

[xsl] is XPath 3.1 xml-to-json() function useful

2019-03-08 04:49:20
Hi all,
   I find the XPath 3.1 function json-to-xml() quite useful. It can convert
any JSON input to an XML representation. But I'm not convinced that XPath
3.1's xml-to-json() function (as defined in the spec) is much useful.

Taking an example from XPath 3.1 F&O spec, the following XML document

<array xmlns="http://www.w3.org/2005/xpath-functions
"><number>1</number><string>is</string><boolean>1</boolean></array>

converts into following JSON by the function xml-to-json(),

[1,"is",true]

(which is fine)

But as per the XPath 3.1 F&O spec, simple XML documents like,

<root>
   <val>1</val>
   <val>2</val>
   <val>3</val>
   <val>4</val>
</root>

cannot be converted into JSON, by the function xml-to-json(), since the XML
input doesn't conform to structure like <array>, <number>, <string> etc
(which looks to me, a very limited capability given to the xml-to-json()
function).

Any comments would be useful.




-- 
Regards,
Mukul Gandhi
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>