I'm trying to filter some XML in JavaScript using E4X and have some specific needs. Given the following:
var xml = <body> <div> <p>This is some text that I have.</p> </div> </div>;
I want to search the document for paragraphs starting with "This is some text".
Currently I can the following to get at the paragraph:
xml..div(p.text().toString().indexOf("This is some text") === 0)
However, the "real" XML is much more complex (think: a regular web page). There is no guarantee that there will be a div directly parenting the paragraph(s) in questions. There may be other paragraphs before/after the paragraph(s) in question within the same parent element.
Any ideas?