How to read the XML node and compare two XML documets

  • Thread starter Thread starter Naga
  • Start date Start date
N

Naga

Hello,
I want to read two XML documents and compare the nodes. And I want to
Modify the second XML File by deleting the Node.
Here in the Example bothe Files has MessageID as common and If i see the
MessageID Result Code Error then I need to Delete it from the First.

How do I do this ....



Thanks
Naveen.


Example :
One.xml
<Message>
<MessageID>1</MessageID>
<Relationship>
<ParentSKU>0113311000000</ParentSKU>
<Relation>
<SKU>0113508000000</SKU>
<Type>Accessory</Type>
</Relation>
</Relationship>
</MessageID>
</Message>

Two.xml

<Result>
<MessageID>1</MessageID>
<ResultCode>Error</ResultCode>
<ResultMessageCode>8008</ResultMessageCode>
<ResultDescription>The entry for SKU [0400235000000] contains an
invalid or unrecognized SKU. Please correct the SKU and resubmit
the item with your next feed. The item will appear with the next catalog
build.</ResultDescription>
</Result>
 
Load your second XML into XMLDoc object. Select all nodes that have "Error"
in "ResultCode" and read their ID's. Load your first XML into and XMLDoc
object, select and delete all nodes that have the ID's collected in the
first XMLDoc.
 
Back
Top