|
-
January 17th, 2003, 06:02 AM
#1
What XPATH expression to use
I need an XPATH expression to to the following
I have a DOM as below
<Data>
<Object>
<A ExternalId="A"/>
<B ExternalId="B"/>
<A ExternalId="C"/>
<B ExternalId="D"/>
</Objects>
</Data>
I am looking for an XPath expression that will give me the node
<A ExternalId="C"/>
However all I know is that the node is a first level child of "/Data/Objects" and that it has an attribute "ExternalId" with a value of "C"
I tried the following but it doesnt work
oDOM.selectSingleNode("/Data/Objects/.[@ExternalId='C']")
Any ideas
All code on this page is protected by an SEP field!!!
-
January 17th, 2003, 02:20 PM
#2
You're close, but your xml is invalid to begin with.
Code:
<Data>
<Objects>
<A ExternalId="A"/>
<B ExternalId="B"/>
<A ExternalId="C"/>
<B ExternalId="D"/>
</Objects>
</Data>
A valid XPath would be "/Data/Objects/A[@ExternalId='C']"
-
February 6th, 2003, 02:40 PM
#3
You may want to try this nice utility that I came across called XPath Explorer.
XPath Explorer
It works great for figuring out how to code those complex xpath commands.
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|