appendchild without adding duplicates - how?

admin

Administrator
Staff member
I have a small app that uses an existing XML document.
It does the following:

- Pulls files by label from SourceSafe
- Adds the files & some path info. for build purposes to the XML
- It then goes back and does this for each build.
ie. If build 1.00.02, it will get 1.00.00, then 1.00.01, then 1.00.02 and put the info. into the XML doc.

The problem I have is that occasionally a file is updated in two or more of the build versions, so it gets added multiple times to the XML doc. how do I check to see if the filename already exists in the node before inserting it in order to avoid duplicates?

<MACHINE>
<NAME>Server 1</NAME>
<STEPS>
- <STEP TYPE="COPYFILE">
<RELDIR />
<FILENAME>DBupdate.sql</FILENAME>
<DESTPATH>D:\install</DESTPATH>
</STEP>
- <STEP TYPE="COPYFILE">
<RELDIR />
<FILENAME>DBupdate.sql</FILENAME>
<DESTPATH>D:\install</DESTPATH>
</STEP>
</STEPS>

I don't want the above to happen. The STEP should only appear once.
 
Back
Top