#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
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 |
#3
|
|||
|
|||
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? |
#4
|
|||
|
|||
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. |
#5
|
|||
|
|||
%READ_XML(D:\build\owners.xml,/component/module[@name='ProjB']/@owner)%
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|