473,395 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to read the XML node and compare two XML documets

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>


Nov 15 '05 #1
2 4853
dd
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.

"Naga" <na*********@hotmail.com> wrote in message
news:OK****************@TK2MSFTNGP12.phx.gbl...
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>


Nov 15 '05 #2
dd
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.

"Naga" <na*********@hotmail.com> wrote in message
news:OK****************@TK2MSFTNGP12.phx.gbl...
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>


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
1
by: Doug | last post by:
I need to compare two "address" structures within a document, and perform some action if they are not equal. The XML document is a purchase order, with an address at both the header and line...
3
by: Andy Fish | last post by:
Hi, I just found this template in someone else's xslt (it's Microsoft's "word2html" stylesheet to convert WordProcessingML to HTML) <xsl:template match="WX:sect"> <xsl:variable...
0
by: Naga | last post by:
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...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
16
by: mailforpr | last post by:
How do I do that? The thing is, the only information I have about the iterator is the iterator itself. No container it is belonging to or anything. Like template<Iteratorvoid...
6
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem :...
42
by: Avon | last post by:
Hello there. I have a problem regarding node deletion in singly-linked lists in C. What happens is that I can't hold the previous node efficiently. Here is the code I use. struct lista *search...
5
by: jorgedelgadolopez | last post by:
Hi all, I am using the xpathnavigator evaluate function on .net (xpath 1 right?). Now I need to expand the code to do multiple contains, compare dates (such as 'before', 'between' and 'after'),...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.