"Cyberthymia" <[EMAIL PROTECTED]> writes:

> I'm currently in the process of adding an XML parser to a project
> I'm working on, using the DOM parser in XercesC.  The problem I've
> got at the moment is that I need to be able to tie in the nodes on
> the DOM tree to the original XML source being processed, i.e.  store
> the start and end character positions for each node (including
> elements, attributes and text data).

> (As a bit of background info, I did originally look at using the SAX
> parser, but I couldn't get this to work as it doesn't throw events
> for the attributes. Besides I need to end up with a DOM interface,
> and didn't want to write my own to sit on top when Xerces gives you
> a perfectly good one already)

> I've had a play around with Xerces and have reached the conclusion
> that there is no way of doing this without modifying the parser code
> itself, and adding new methods to the DOM classes for getting /
> setting the positions.
> 
> Before I start though, I wanted to see if anyone knows of a better
> way of doing this, as any changes I make to the parser are going to
> have to be carefully recorded and reimplemented every time I pick up
> a newer version of Xerces.

I think you probably want to subclass DOMParser (or IDOMParser) and
use your subclass instead of redefining DOMParser. That way you could
add all the methods you wanted.

I'd actually like to see this get implemented for the SAXParser. I
don't need to know where the attributes are, just the elements, so SAX
would do all of what I need. 

jas.

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

Reply via email to