xpath获取全部的child nodes without parent

Xml – XPath to get all child nodes (elements, comments, and text) without parent

Best Solution

From the documentation of XPath ( http://www.w3.org/TR/xpath/#location-paths ):

child::* selects all element children of the context node 

child::text() selects all text node children of the context node 

child::node() selects all the children of the context node, whatever their node type

So I guess your answer is:


And if you want a flatten array of all nested nodes:


阅读量: 19