Skip to content

Find all nodes on specific level #3138

Closed Answered by flavorjones
forthrin asked this question in General Q&A
Discussion options

You must be logged in to vote

@forthrin I generally reach for XPath queries if I'm doing something more complicated than a tag name or an attribute.

Try doc.xpath("//li[not(ancestor::li)]") and if that doesn't do what you want, please provide a sample input and your expected output?

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by flavorjones
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants