473,320 Members | 1,848 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,320 software developers and data experts.

Compare 2 xml files and add missing entries

hello,

I'm writing a application that is using 2 xml-language file.
I want to avoid to maintain both xml-files - that's why I"m writing a
script which shall compare both xml and add missing entries to the
other.(not excactly the same..)

<data name="lbLogin">
<value>User Name</value>
</data>
<data name="lbPassword">
<value>Password</value>
</data>
<data name="lblLogin">
<value>1 User Name</value>
</data>
<data name="lbPassword">
<value>1 Password</value>
</data>

if I add, for example another entry:
<data name="text">
<value>text</value>
</data>

i want that the other language file gets the same data programmatically
with a "1" in fron of the data

therefor I wrote the following:

XmlDocument xmlDocRes2 = new XmlDocument() ;
xmlDocRes2.Load(resFile) ;

XmlDocument xmlDoc = new XmlDocument() ;
xmlDoc.Load(resFileEnglish) ;

XmlNodeList nodeList;
XmlElement root = xmlDoc.DocumentElement;
nodeList = root.SelectNodes("/root/data/@name");
foreach (XmlNode name in nodeList)
{
// check if xml-node exists:
// Type XmlNodeType = typeof(XmlNode);
// instance of the XML node type.
// if (XmlNodeType.IsInstanceOfType(MyNode1))
// {

XmlNode MyNode1 = xmlDocRes2.SelectSingleNode("/root/data/@name='" +
name.Value + "'");

}

but I'm not coming to the point where I am check if the node exists ...
and add the changed node to the other xml-file
I simply fail to select a single node ---- with the error-- "expecting
a NodeSet".

has anybody a hint or a suggestion what I'm doing wrong

thanks

best regards

thomas

Apr 18 '06 #1
0 1135

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

Similar topics

4
by: Hal Vaughan | last post by:
I am writing out archive files using ZipOutputStream with the following code: aEntry is a global Array of ZipEntries llData is a LinkedList of the data corresponding to the the ZipEntry of the...
6
by: Robin Siebler | last post by:
I have two directory trees that I want to compare and I'm trying to figure out what the best way of doing this would be. I am using walk to get a list of all of the files in each directory. I...
1
by: Simon Gare | last post by:
Hi I need to compare a dynamic field in an asp page to a field in another table, if there is no match then i would like to chane the row colour ( see code below). The problem Im having is...
2
by: RitaG | last post by:
Hi. In a VB.Net program I use File.Copy to copy some zipped (and text) files from one server to another. I'm required by management to do a file compare after the copy has completed. Is the...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
6
by: Charles Neitzel | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
2
by: yinglcs | last post by:
I am new to python. How can I compare if 2 files has duplicate entries in python? Is there an example for that? What if the files are big and I don't want to read the whole file in memory. ...
1
by: Twinkle | last post by:
HI All, I have a problem..How to match two same word files. if someword missing in second files then it should be highlight by color change.
1
by: cssExp | last post by:
Hi, Assume i have two tables. "accounts" and "accounts_logs" "accounts" (accid, type) "accounts_log" (accid, ip, timestamp) Here i want to choose a radom 3 accids from "accounts" if...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.