|
-
Dec 9th, 2004, 09:36 AM
#1
Thread Starter
Lively Member
XPath - Return current node without child nodes
Good day.
I hv the following XML for example and I tried to write a XPath query to return just the <AAA> and omit all the other child nodes (BBB and CCC and BBBBB) .
<AAA Name='aaa' ID='aaa'>
<BBB>bbbbbbbbbb</BBB>
<BBBBB>bbbbbbbbbbbbbbb</BBBBB>
<CCC>cccccccccc</CCC>
</AAA>
I tried //AAA/self::* but it still return the whole childnodes to me.
Any idea how to accomplish this ?
Thanks.
SonicWave
-
Dec 9th, 2004, 10:01 AM
#2
Re: XPath - Return current node without child nodes
I suppose XPath returns the AAA node, which has all other nodes as descendants, right? I cannot imagine that it returns a NodeSet that directly contains all the nodes.
Well, that's something you can't change with XPath. XPath only returns references to nodes, it can't change them. Returning a reference means that in order to have no child nodes, it must either return a copy or modify the referenced node. Neither makes sense.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|