XPath to get one level of childnodes

jacksonathens

New Member
Using DOMXPath::query is it possible to get just one level deep of childNodes?For example if I had a document like:\[code\]<div> <span> <cite> </cite> </span> <span> <cite> </cite> </span></div>\[/code\]I would want the NodeList to contain just the spans and not the cites.Should also mention that it won't always be the same elements (divs, spans, etc). I would need it to work with any type of element.This is what I tried and it didn't seem to work:\[code\]//*[not(ancestor::div)]\[/code\]
 
Back
Top