|
#1
|
|||
|
|||
XML Question
I have a lot of scripts that I need to do a mass change to, I wanted to create a script that would modify all build scripts in a specific directory.
I am trying to delete all the Project Level Subs from these scripts, when I use the Write XML Action I search for Xpath="project/steps[[attribute::type=1]]" But I dont see an option to remove that node? How is this accomplished? Also when I compare the changes made to the orginal Script, all the single quotes in the XML attributes are changed for single to double, why is that and is there a way to prevent that. I am using WinMerge to compare the original file with the changed one while developing my script. I will be making a lot of changes and I am having trouble compareing the changes I made with all these extra double quotes. |
#2
|
|||
|
|||
The quote change is a normalization done by MSXML.
I would recommend using the VBP object model to make a change like that. See the attached sample. http://www.kinook.com/VisBuildPro/Ma...bjectmodel.htm |
#3
|
|||
|
|||
thanks that works great for removing, but what about updating. Lets say that I want to get rid of all the Subs but then replace it with ones I have already created.
Would it be better to use regular expression to seach and replace this XML. I dont want to programaticly recreate these steps. |
#4
|
|||
|
|||
Yes, you could also use the Replace in File action for that. See attached.
|
#5
|
|||
|
|||
Thanks, this really helped a lot.
I am now able to script most of the changes. When I make a change to how a script works I try to modify all scripts to include newer functionality so that they all process the same way. |
#6
|
|||
|
|||
I am still running into an issue with the Replace in file. The macro I am assigning is a replacement of some of the actual script XML so I made sure that all % were doubled up and when setting the macro I checked the "Don't expand macro or scripts in value when setting." There are ( ) in the macro and when I assignen the value in the replace function they are removed. not sure why should they also be doubled, that didnt seem to work
|
#7
|
|||
|
|||
You need to escape ( and ) like \( and \) so the regex engine treats them as literals.
|
#8
|
|||
|
|||
Thanks everthing is working prefectly now, I didnt think to check that the REGEX was evaluted in the replace field too, thanks for the info.
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|