KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to use XPath to select only the nodes that have a particular child elements? For example, from this XML I only want the elements in pets that have a child of 'bar'. So the resulting dataset would contain the lizard and pig elements from this example: <pets> <cat> <foo>don't care about this</foo> </cat> <dog> <foo>not this one either</foo> </dog> <lizard> <bar>lizard should be returned, because it has a child of bar</bar> </lizard> <pig> <bar>return pig, too</bar> </pig> </pets> This Xpath gives me all pets: "/pets/*" , but I only want the pets that have a child node of name 'bar' .
Tags (comma-separated)
Save Edits
Cancel