org.w3c.dom, line number
Posted on 2007-07-30
I have this:
InputStream in = new FileInputStream(fileName);
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
Document doc = dfactory.newDocumentBuilder().parse(new InputSource(in));
Given a node belonging to doc,
I would like to know at which line of text (of the file fileName) this node starts.
(I assume I have not modified the document)
int lineNumber = XmlUtil.getLineNumber(fileName, doc, node);
Are you aware of a xml util package that has this functionality?
(compatible with org.w3c.dom)