Is there an API which gives me JSON in String format if I pass my XML document and the XPath? If I pass the xpath and the XML document as below
/domain:networkConfig/devices[@type='computer']/device/ipDetails/ipDetail
XML is
<?xml version="1.0" encoding="UTF-8"?>
<domain:networkConfig >
<devices type="computer">
<device vs:registerSysid="897">
<ipDetails>
<ipDetail nic="eth0" nicDesc="myZone" primaryEditable="false">
<ipAddress>192.168.31.101</ipAddress>
<gateway>192.168.31.31</gateway>
<netmask>255.255.255.0</netmask>
</ipDetail>
</ipDetails>
<routeDetails/>
</device>
</devices>
</domain:networkConfig>
Then it should give me the JSON as a String as
"ipDetail": {
"nic": "eth0",
"nicDesc": "myZone",
"primaryEditable": false
}
No comments:
Post a Comment