[jdom-interest] Getting comments in a Document

David Patterson dpatterson at i-a-i.com
Wed May 10 14:00:23 PDT 2006


This may be the wrong forum, but I hope someone knows this answer. I'm using
Java 1.4 with the default parser and JDOM. I process an XML document that
has comments in it. After getting a good Document object, my code has:

 

            Filter comments = new ContentFilter( ContentFilter.COMMENT );

            List commentList = newPrelDoc.getContent( comments );

            System.out.println( "commentList size is: " +
commentList.size());

 

And, I'm getting a value of zero as the size. (A) Is this the right way to
use this filter? (B) Is it known that the default parser blocks comments?
(C) Is there a magic incantation to get it to pass comments along? (D) Does
a different parser pass comments through?

 

Thanks.

 

 

David R. Patterson

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20060510/cf963e65/attachment.htm


More information about the jdom-interest mailing list