PhoenixmlDb.XQuery
JsonXmlConverter
The one mapping of JSON to XML: the XML representation of JSON that fn:json-to-xml defines (XPath and XQuery Functions and Operators 3.1 §17.4.2), as an API. It is the code the function itself runs, so a host that stores or exchanges JSON as XML gets the tree a query gets, and fn:xml-to-json turns it back.
#JsonXmlConverter
Namespace: PhoenixmlDb.XQuery
The one mapping of JSON to XML: the XML representation of JSON that
fn:json-to-xml
defines (XPath and XQuery Functions and Operators 3.1 §17.4.2), as an API. It is the code the function itself runs, so a host that stores or exchanges JSON as XML gets the tree a query gets, and
fn:xml-to-json
turns it back.
{"tags":["a"],"n":1}
becomes
<map xmlns="http://www.w3.org/2005/xpath-functions">
<array key="tags"><string>a</string></array>
<number key="n">1</number>
</map>
(without the white space). An array of one item stays an array, and a number stays a number.
#Methods
#ToXml(String,PhoenixmlDb.XQuery.INodeBuilder,PhoenixmlDb.XQuery.JsonToXmlOptions)
Builds the XML representation of
in
.
Parameters:
-
json— The JSON text. -
builder— The store the document's nodes are made in. -
options—JsonToXmlOptions.Defaultwhen null.
Returns: The document node; its one child is the element for the JSON value.
Exceptions:
-
XQueryException—FOJS0001: the text is not JSON.FOJS0003: a key is repeated andJsonToXmlOptions.DuplicatesisJsonDuplicateKeys.Reject. -
ArgumentException— BothJsonToXmlOptions.Escapeand a fallback are set.
#ToXmlText(String,PhoenixmlDb.XQuery.JsonToXmlOptions)
The XML representation of
as markup, with no XML declaration and no added white space.