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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.