473,325 Members | 2,870 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,325 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 4851
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.