How to pull out data from xml that is deeply nested...

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Simply put, I need to pull out the following data from the below XML:
deviceinfo1

devicestatus: workingflowrate: 25

deviceinfo2

devicestatus: defectiveflow rate: 37

<pre class="prettyprint <testManagementReport xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<referenceID>Bin02</referenceID>
<reportType>subscription</reportType>
<managementReport>
<objectBasedReport>
<objectID>deviceInfo1</objectID>
<objectBasedReportElement>
<nameValue>
<objectAttribute>devicestatus</objectAttribute>
<attributeValue>working</attributeValue>
</nameValue>
<nameValue>
<objectAttribute>flowrate</objectAttribute>
<attributeValue>25</attributeValue>
</nameValue>
</objectBasedReportElement>
</objectBasedReport>
<objectBasedReport>
<objectID>deviceInfo2</objectID>
<objectBasedReportElement>
<nameValue>
<objectAttribute>devicestatus</objectAttribute>
<attributeValue>defective</attributeValue>
</nameValue>
<nameValue>
<objectAttribute>flowrate</objectAttribute>
<attributeValue>37</attributeValue>
</nameValue>
</objectBasedReportElement>
</objectBasedReport>
</managementReport>
</testManagementReport>[/code]
<br/>
Needs to be dynamic because the number of devices (objectBasedReport tags) can be anywhere from 1 - 200. Any good suggestions or examples to query this?<br/>


View the full article
 

Similar threads

M
Replies
0
Views
93
M Azeem Ahmad
M
M
Replies
0
Views
85
MosheS Singer
M
B
Replies
0
Views
60
Broggy69
B
Back
Top