Say you have an XML file that looks like this:
<KW>
<Subjects SubjectID="00100" SubjectDescription="ABORTION"/>
<Subjects SubjectID="00010" SubjectDescription="ABUSE * ADULT *
INVESTIGATION"/>
<Subjects SubjectID="06450" SubjectDescription="ABUSE * CHILD ABUSE *
COUNSELING"/>
</KW>
I'm trying to configure the XPath property of a C# XMLDataSource
object so that I can grab the rows in this XML file for which the
SubjectDescription contains a given search criteria. For example, if
the criteria were "ABUSE", the last two rows of the XML would be
returned as a result set.
What exact XPath syntax would perform this query?
Arne Vajhøj - 04 Feb 2008 01:12 GMT
> Say you have an XML file that looks like this:
>
[quoted text clipped - 13 lines]
>
> What exact XPath syntax would perform this query?
Try:
"//KW/Subjects[@SubjectDescription='foobar']"
Arne
Martin Honnen - 04 Feb 2008 12:48 GMT
> Say you have an XML file that looks like this:
>
[quoted text clipped - 13 lines]
>
> What exact XPath syntax would perform this query?
/KW/Subjects[contains(@SubjectDescription, 'ABUSE')]

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Darth Continent - 04 Feb 2008 14:19 GMT