views:

20

answers:

1

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

Is it possible to get the line number and column number from a org.w3c.dom.Node?

+1  A: 

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

DOM trees are not related to a specific serialization. In fact, there are various ways to output a DOM tree, and they might give different results for an element line number.

When you parse an XML document into a DOM, you might be able to get a SAXParseException with a line number if there is an error. But the information is lost after parsing.

Damien