Tuesday, July 14, 2009

XML - XPath syntax help?

Say you have an XML file that looks like this:





%26lt;KW%26gt;


%26lt;Subjects SubjectID="00100" SubjectDescription="ABORTION"/%26gt;


%26lt;Subjects SubjectID="00010" SubjectDescription="ABUSE * ADULT * INVESTIGATION"/%26gt;


%26lt;Subjects SubjectID="06450" SubjectDescription="ABUSE * CHILD ABUSE * COUNSELING"/%26gt;


%26lt;/KW%26gt;





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?

XML - XPath syntax help?
I am working on something like this to answer but this isn't right yet:





//KW/Subjects[starts-with(@SubjectDesc...


No comments:

Post a Comment