I don't think so.  Any given node might or might not derive from a parse
operation, so keeping row and column for nodes is challenging.  What
would you do if a node had been inserted or deleted ahead of the node
you're currently analyzing - should the file position data for
subsequent parsed nodes be retained or discarded?  What values do you
use for nodes that you've added?  Furthermore, not every application
wants this information, and there's overhead for carrying it around for
every node.

You might find that a SAX parser would serve your needs better.  You can
then use a DocumentLocator.  From the
ContentHandler::setDocumentLocator() documentation: "The locator allows
the application to determine the end position of any document-related
event, even if the parser is not reporting an error. Typically, the
application will use this information for reporting its own errors (such
as character content that does not match an application's business
rules)."

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 12, 2006 12:28 PM
To: [email protected]
Subject: how to locate a DOMNode in it's source file

I parsed an XML document with the xerces DOM parser and receive a DOM
tree as a result. Subsequently, I analyse the DOM tree. 
However, my code might detect errors during the analysis, and report
them. The problem here is though that I only have the DOM tree and it's
nodes, so for a given DOMNode* containing the offending node, I'd need
to find out the position in the source file from which it was generated.
Is there an easy way of doing that with Xerces? 

Cheers,

Uwe

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to