Why can't find the comment in org.xml.sax.ext.DefaultHandler2

R

RC

In my XML file there are many <!-- comments -->

I am using org.xml.sax.ext.DefaultHandler2

Accord to the API the comment method
Report an XML comment anywhere in the document.
But I don't get any print out from below
comment method!

Can anyone tell me what I do wrong?
Thank you very much in advance!

@Override
public void comment(char[] ch, int start, int length)
throws SAXException
{

if (ch != null && ch.length > 0)
{
String tmpstr = new String(ch, start, length);
if (tmpstr != null && ! tmpstr.trim().equals(""))
{
System.out.println("comments ---------> " +
tmpstr.trim());
} // end inner if
} // end outer if
} // end method
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top