Getting row number and column number from org.w3c.dom.Node

I know that you can get the row number and column number from org.xml.sax.SAXParseException.

Is it possible to get row number and column number from org.w3c.dom.Node?

+4
source share
1 answer

No (at least not with the standard DOM API).

DOM trees are not associated with specific serialization. In fact, there are various ways to output the DOM tree, and they can give different results for the line number of the element.

When parsing an XML document in the DOM, you may get a SAXParseException with a line number if there is an error. But after parsing the information is lost.

+3
source

All Articles