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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top