Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   XML Question (https://www.kinook.com/Forum/showthread.php?t=4291)

HippyCraig 11-10-2009 09:11 AM

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.

kinook 11-10-2009 10:04 AM

1 Attachment(s)
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

HippyCraig 11-10-2009 11:50 AM

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.

kinook 11-10-2009 12:41 PM

1 Attachment(s)
Yes, you could also use the Replace in File action for that. See attached.

HippyCraig 11-10-2009 02:11 PM

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.

HippyCraig 11-11-2009 12:24 PM

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

kinook 11-11-2009 01:56 PM

You need to escape ( and ) like \( and \) so the regex engine treats them as literals.

HippyCraig 11-12-2009 09:11 AM

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.


All times are GMT -5. The time now is 10:12 PM.


Copyright © 1999-2023 Kinook Software, Inc.