Obtains the value of a XML node of an JSON object which is obtained as result of parse a XML document
with the function json.fromXML.
1 json.get
<json.get name='name'>
<json /> !
</json.get>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | Name of the node |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Ejson | JSONObject obtained of the parse of the XML object via the function json.fromXML. |
Returns | |
---|---|
Type | Description |
String|JsonObject|JsonArray | If it is a final node, returns the string of the node. If the node contains another nodes, returns the Json object which can be explored and if contains multiples nodes, returns an array with the nodes which accomplish the searching condition. |
Example
Copy
<xsql-script name='exemple_json'> <body> <set name='m_invoice'> <dom.parse> <file name='C:\jas\Invoice.xml' type='absolute' /> </dom.parse> </set> <set name='m_json'> <json.fromXML> <m_invoice /> </json.fromXML> </set> <println> <json.get name='Invoice.ThirdCode'><m_json /></json.get> </println> <iterator name='m_lines'> <in><json.get name='Invoice.Lines'><m_json /></json.get></in> <do> <println> <json.get name='Amount.Value'><m_lines /></json.get> </println> </do> </iterator> </body> </xsql-script>
Example
Copy
<xsql-script> <body> <set name = 'm_xml'> <![CDATA[<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <Contract> <Header> <CompanyCode>0756</CompanyCode> <Date>2017-09-21T17:30:26</Date> </Header> <Conditions> <Condition number="1">1150</Condition> <Condition number="2">2150</Condition> </Conditions> </Contract> ]]> </set> <set name='m_json'> <json.fromXML> <dom.parse> <m_xml/> </dom.parse> </json.fromXML> </set> <iterator name='cond'> <in> <json.getArray name='Contract.Conditions.Condition'><m_json/></json.getArray> </in> <do> <println>Number: <map.get name='cond'><string>number</string></map.get></println> <println>Value: <map.get name='cond'><string>#text</string></map.get></println> </do> </iterator> </body> </xsql-script>