w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
calculate xpath of Node ifits parent Node is null

If you have nodes that are not attached to a document (or if you are looking at the root node of a document), then it is of course impossible to find a (relative) XPath that matches this node. I assume you're looking for a step-by-step path expression rather than something like


which would be an expression that matches any node in a document.

The real question is: Why are the nodes you're looking at not attached to a document, and what do you need the XPath for?

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.