Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Getting comments in a Document

David Patterson

2006-05-10

Replies:

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

 

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.