Kinook Software Forum

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

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-23-2006, 04:56 PM
Albert Albert is online now
Registered User
 
Join Date: 08-18-2006
Posts: 9
//element[@attribute] in vbscript

I'm trying to write a script that executes an xpath query that contains square brackets but I keep getting errors. The script works when tested in a .vbs file.

I think it has something to do with the [] brackets. I tried using the literal syntax using double brackets but it still produces an error. Is there any way to write this to get it to work in Visual Build Pro?

1st example:
Set doc = CreateObject("MSXML.DOMDocument")
doc.load(myfile.xml)
myXpath = "//element[@attribute]"
Set nodes = doc.selectNodes(myXpath)

2nd example:
myXpath = "//element[[@attribute]]"

Thank You!
Reply With Quote
  #2  
Old 08-23-2006, 09:45 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The attached sample works ok here (outputs the text of the step elements in the current project). Note that in the Script code field of a Run Script action, brackets don't need to be doubled since the entire field is already expected to be script code (brackets denote script expressions in other fields).
http://www.visualbuild.com/Manual/runscript.htm
http://www.visualbuild.com/Manual/scriptexpressions.htm
Attached Files
File Type: bld xpath.bld (576 Bytes, 1561 views)
Reply With Quote
  #3  
Old 08-24-2006, 09:17 AM
Albert Albert is online now
Registered User
 
Join Date: 08-18-2006
Posts: 9
Thank you for always replying so promptly to all of my posts. Here's something wierd. I came in this morning and I no longer get the errors. The script now works fine. I don't understand it and I won't question it.

Thank you for all your help!
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 08:24 AM.


Copyright © 1999-2023 Kinook Software, Inc.