PDA

View Full Version : Write XML Element if not exist


Hess_Joel
12-14-2009, 10:17 AM
I want to query a file for an element with a specific attribute, and if it doesn't exist, add a new element. I keep getting this error:

This name may not contain the '[' character:File-->[<--@FileName='Test']

Attached is an example of what I'm trying,

kinook
12-14-2009, 10:32 AM
So you want the file

<UpdatedFiles>
<File FileName="PNet.GlobalConstants.dll" From="1.6.3.73" To="1.6.2.16"/>
</UpdatedFiles>

to be updated like this?

<UpdatedFiles>
<File FileName="PNet.GlobalConstants.dll" From="1.6.3.73" To="1.6.2.16"/>
<File FileName="somefilename.ext" />
</UpdatedFiles>

The Write XML action doesn't support creating a new element and attribute like that. You could write some script code in a Run Script action to do the specific query and update you want to do.
http://www.google.com/search?q=msxml+vbscript