troubleshooting Question

org.w3c.dom, line number

Avatar of dportabella
dportabella asked on
JavaXML
2 Comments1 Solution465 ViewsLast Modified:
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)

Something like
int lineNumber = XmlUtil.getLineNumber(fileName, doc, node);

Are you aware of a xml util package that has this functionality?
(compatible with org.w3c.dom)

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros