Kinook Software Forums

Go Back   Kinook Software Forums > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-23-2007, 04:30 PM
Too_Tall_Crown_Victoria Too_Tall_Crown_Victoria is online now
Registered User
 
Join Date: 01-14-2003
Posts: 44
Loop over a generic XML file

I have an xml file that I need to loop over. The xml.bld example shows how to loop on attributes of a node. I need to loop on the contents of sub nodes. For example:

<dependencies>
<component>
<name>ProjA</name>
<version>1.2.3</version>
</component>
<component>
<name>ProjB</name>
<version>2.3.4</version>
</component>
</dependencies>

Is there a simple way to set this up and loop on each component and retrieve it's cooresponding version number?

Thanks

Tom
Reply With Quote
  #2  
Old 07-23-2007, 05:32 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,743
Attached.
Attached Files
File Type: zip xml2.zip (1.8 KB, 834 views)
Reply With Quote
  #3  
Old 10-26-2007, 09:22 AM
Too_Tall_Crown_Victoria Too_Tall_Crown_Victoria is online now
Registered User
 
Join Date: 01-14-2003
Posts: 44
I have an additional challenge with this:

If we assume:

<dependencies>
<component>
<name>ProjA</name>
<version>1.2.3</version>
</component>
<component>
<name>ProjB</name>
<version>2.3.4</version>
<file_name>myfile.dll</file_name>
<file_name>myfile2.dll</file_name>
<file_name>myexe.exe</file_name>
</component>
</dependencies>

We now have a need to have an optional <file_name> node. However when I use the selectsinglenode and a node is not there the vbscript errors out.

So how can I check to see if a node exists, and if it does how can I loop on it in this format.

Thanks in advance. Please ignore previous reply.
Reply With Quote
  #4  
Old 10-26-2007, 11:10 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,743
See attachment.
Attached Files
File Type: bld xml3.bld (7.3 KB, 818 views)
Reply With Quote
  #5  
Old 11-01-2007, 11:35 AM
Too_Tall_Crown_Victoria Too_Tall_Crown_Victoria is online now
Registered User
 
Join Date: 01-14-2003
Posts: 44
The script worked great for looping and reading the multi node that may or may not exist.

What I need now is to take this list and write it to a macro. I need this in a macro because I need to loop on each of these elements later in the script. How can I accomplish this?
Reply With Quote
  #6  
Old 11-01-2007, 02:15 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,743
Attached.
Attached Files
File Type: bld xml4.bld (8.1 KB, 897 views)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 09:35 PM.


Copyright 1999-2019 Kinook Software, Inc.