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 07-13-2007, 04:15 PM
Too_Tall_Crown_Victoria Too_Tall_Crown_Victoria is online now
Registered User
 
Join Date: 01-15-2003
Posts: 44
XPath Help

I am trying to understand how to use xpath and VBP. I have an xml file that will contain the owners of each of our modules. The format is as follows:

<component>
<module name="ProjA" owner="bob@bob.com"/>
<module name="ProjB" owner="tim@tim.com"/>
. . .
</component>

I was using a Step Property action with a value:

[%READ_XML(D:\build\owners.xml,/Component/owner=@module name=%MY_PROJECT%)%]

All I get are errors.

I can get this to work if I use the format:

<component>
<ProjA>
<owner>bob@bob.com</owner>
</ProjA>
<ProjB>
<owner>tim@tim.com</owner>
</ProjB>
. . .
</component>

However I am told that this is not a properly formatted xml file.

Thanks for your help.
Reply With Quote
  #2  
Old 07-16-2007, 08:02 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Both a valid XML, although the second one would be difficult to define a schema for.

/Component/owner=@module name=xyz

is not valid XPath. I'm not sure what you're actually trying to retrieve from the XML file?

Here some XPath tutorials:
http://www.google.com/search?hl=en&q=xpath+tutorial
http://en.wikipedia.org/wiki/XPath#External_links
Reply With Quote
  #3  
Old 07-16-2007, 08:57 AM
Too_Tall_Crown_Victoria Too_Tall_Crown_Victoria is online now
Registered User
 
Join Date: 01-15-2003
Posts: 44
Here is my new XPath command:

[%READ_XML(D:\build\owners.xml,/Component//module[@name=%MY_PROJECT%)%]

This works but I get a blank macro.

A co-worker of mine is suggesting that the READ_XML macro is not capable of reading and returning just the value of owner. As they cannot find anyway for XPATH to return a specific item in the attribute field.

Do I need to use another tool to get this information?
Reply With Quote
  #4  
Old 07-16-2007, 09:04 AM
Too_Tall_Crown_Victoria Too_Tall_Crown_Victoria is online now
Registered User
 
Join Date: 01-15-2003
Posts: 44
I have even tried:

[%READ_XML(D:\build\owners.xml,/Component//module[@name=%MY_PROJECT%/@owner)%]

It does not fail but I get no results. When I need to recieve bob@bob.com for example.
Reply With Quote
  #5  
Old 07-17-2007, 10:32 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
%READ_XML(D:\build\owners.xml,/component/module[@name='ProjB']/@owner)%
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:56 PM.


Copyright © 1999-2023 Kinook Software, Inc.