alanchinese
Well-known member
- Joined
- Jan 12, 2005
- Messages
- 58
i wonder if there is a simple xpath query to retrieve a list of book IDs whose notes Descendants evaluates a dynamic condition to be true. to make it simple, consider the following XML.
<BOOKS>
<BOOK ID=1234>
<CATEGORIES>1,2,9</CATEGORIES>
</BOOK>
<BOOK ID=2333>
<CATEGORIES>2,7,8</CATEGORIES>
</BOOK>
<BOOK ID=5555>
<CATEGORIES>1,7,8</CATEGORIES>
</BOOK>
</BOOKS>
Dim sRule1 as String = "(contains//CATEGORIES, 2)"
Dim sRule2 as String = "(contains//CATEGORIES, 8)"
when sRule1 is used, IDs 1234, 2333 would be returned.
when sRule2 is used, IDs 2333, 5555 would be returned.
<BOOKS>
<BOOK ID=1234>
<CATEGORIES>1,2,9</CATEGORIES>
</BOOK>
<BOOK ID=2333>
<CATEGORIES>2,7,8</CATEGORIES>
</BOOK>
<BOOK ID=5555>
<CATEGORIES>1,7,8</CATEGORIES>
</BOOK>
</BOOKS>
Dim sRule1 as String = "(contains//CATEGORIES, 2)"
Dim sRule2 as String = "(contains//CATEGORIES, 8)"
when sRule1 is used, IDs 1234, 2333 would be returned.
when sRule2 is used, IDs 2333, 5555 would be returned.