Contains Function!!! Please Help me (XPath)
-
I want to make a query that works like 'LIKE' in SQL I want to retrive nodes that starts with 'X' or any starting string Or containg 'X' I write this XPath: Message[Contains(@Title,'5')] But it's wrong!! how can I do?? plz help me <code> <Message MessageID="1" Title="Title1" Icon="Information" Buttons="Ok"> <Parts Part="part333333" /> <Parts Part="part333333" /> <Parts Part="part333333" /> </Message> <Message MessageID="2" Title="Title2" Icon="Information" Buttons="Ok"> <Parts Part="part333333" /> </Message> <Message MessageID="3" Title="Title3" Icon="Information" Buttons="Ok"> <Parts Part="part33XXXX3333" /> <Parts Part="YYpart53" /> </Message> <Message MessageID="4" Title="Title4" Icon="Information" Buttons="Ok"> <Parts Part="YYpart53" /> </Message> </code>
-
I want to make a query that works like 'LIKE' in SQL I want to retrive nodes that starts with 'X' or any starting string Or containg 'X' I write this XPath: Message[Contains(@Title,'5')] But it's wrong!! how can I do?? plz help me <code> <Message MessageID="1" Title="Title1" Icon="Information" Buttons="Ok"> <Parts Part="part333333" /> <Parts Part="part333333" /> <Parts Part="part333333" /> </Message> <Message MessageID="2" Title="Title2" Icon="Information" Buttons="Ok"> <Parts Part="part333333" /> </Message> <Message MessageID="3" Title="Title3" Icon="Information" Buttons="Ok"> <Parts Part="part33XXXX3333" /> <Parts Part="YYpart53" /> </Message> <Message MessageID="4" Title="Title4" Icon="Information" Buttons="Ok"> <Parts Part="YYpart53" /> </Message> </code>
Masterhame wrote:
how can I do??
Well you can only do what XPath supports. Also you might find that the latest XPath standards are not fully supported by many of the XPath implementations so you need to check the specific engine you are using to determine what standard it supports.
led mike