I've written what I want to achieve. however, getElementIdx() function doesn't return proper count. There's an issue with getPreviousSibling() but I don't know why.
public static String getElementXpath(DOMElement elt){
...
What is the most efficient way to iterate through all DOM elements in Java?
Something like this but for every single DOM elements on current org.w3c.dom.Document?
How do you quickly locate element/elements via xpath string on a given org.w3c.dom.document? there seems to be no FindElementsByXpath() method. For example
/html/body/p/div[3]/a
I found that recursively iterating through all the child node ...
Thanks for all of you. The code indicates that I need to get the node by tag name. If I do not know the distribution of the elements and want to traverse all nodes. If the node contains value, I retrieve the value. How to implement the general case. For example, my XML file represent a directory hierarchy and looks like ...