S
sehiser
Hello,
I've been reading up on xpath and I am able to access elements with it.
I haven't been able to figure one thing out though.
How would I use XPath to select an element where the text equals what
I'm looking for?
If I select a book topic (in the traditional of XML examples) of
Programming and it returns 200 books, and I want to specifically select
books with an element named "topic" text of "C++" what would the xpath
be?
<books>
<category>
<topic>Linux</topic>
<title>Linux ABC's</title>
<desc>The ABC's of Linux</desc>
<topic>C++</topic>
<title>Beginning C++</title>
<desc>C++ programming for beginners</desc>
<topic>C++</topic>
<title>Patterns in C++</title>
<desc>Advanced C++ programming</desc>
</category>
</books>
If I wanted to only select the elements in category matching the topic
text of C++, how would I use XPath to achieve this?
I thought it would be something like //books/category[topic='C++'] but
I get a node test expected error. I'm adding XML support to a VB
application and using MSXML6, but I don't think that's relevant to
XPath syntax.
Thanks.
I've been reading up on xpath and I am able to access elements with it.
I haven't been able to figure one thing out though.
How would I use XPath to select an element where the text equals what
I'm looking for?
If I select a book topic (in the traditional of XML examples) of
Programming and it returns 200 books, and I want to specifically select
books with an element named "topic" text of "C++" what would the xpath
be?
<books>
<category>
<topic>Linux</topic>
<title>Linux ABC's</title>
<desc>The ABC's of Linux</desc>
<topic>C++</topic>
<title>Beginning C++</title>
<desc>C++ programming for beginners</desc>
<topic>C++</topic>
<title>Patterns in C++</title>
<desc>Advanced C++ programming</desc>
</category>
</books>
If I wanted to only select the elements in category matching the topic
text of C++, how would I use XPath to achieve this?
I thought it would be something like //books/category[topic='C++'] but
I get a node test expected error. I'm adding XML support to a VB
application and using MSXML6, but I don't think that's relevant to
XPath syntax.
Thanks.