File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Getting comment data in SAX ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Getting comment data in SAX ?" Watch "Getting comment data in SAX ?" New topic

Getting comment data in SAX ?

Celina Paul

Joined: Nov 01, 2003
Posts: 16
I had posted this question earlier in XML group, never got an answer.

In DOM, there is a COMMENT_NODE to get the comment data, but if I have to get the data in a comment node in SAX, what can I do?

When the parser comes across a comment node, there is no callback method defined for this in SAX.

Is there a way to get that data in SAX ?
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
AFAIK in SAX 1.0 there is no way to retrieve the XML comments, as SAX assumes that comments are there for the author's benefit, not for the reader's.
I don't know if this is fixed in SAX 2.0.

blog -
I agree. Here's the link:
subject: Getting comment data in SAX ?