开发者

Getting the line number and column number from a org.w3c.dom.Node

开发者 https://www.devze.com 2023-01-20 00:28 出处:网络
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 num开发者_StackOverflow社区ber from a org.w3c.dom.Node

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 num开发者_StackOverflow社区ber from a org.w3c.dom.Node?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消