Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-10-2009, 10:11 AM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
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.
Reply With Quote
  #2  
Old 11-10-2009, 11:04 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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
Attached Files
File Type: zip remove_subs.zip (757 Bytes, 1975 views)
Reply With Quote
  #3  
Old 11-10-2009, 12:50 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
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.
Reply With Quote
  #4  
Old 11-10-2009, 01:41 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Yes, you could also use the Replace in File action for that. See attached.
Attached Files
File Type: zip replace_subs.zip (706 Bytes, 1986 views)
Reply With Quote
  #5  
Old 11-10-2009, 03:11 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
Talking

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.
Reply With Quote
  #6  
Old 11-11-2009, 01:24 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
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
Reply With Quote
  #7  
Old 11-11-2009, 02:56 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
You need to escape ( and ) like \( and \) so the regex engine treats them as literals.
Reply With Quote
  #8  
Old 11-12-2009, 10:11 AM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 11:02 PM.


Copyright © 1999-2023 Kinook Software, Inc.