I believe it’s possible but couldn’t figure out the syntax. Something like this:
xmlNode.SelectNodes("//*[count(child::*) <= 1]")
but this is not correct.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use:
In case only element leaf nodes are wanted (and this needs clarification — are elements that have non-element children considered leaf nodes?), then the following XPath expression selects them:
Both expressions above are probably the shortest that select the desired nodes (either any-node or element — leaf nodes).