[jdom-interest] remove comments

John C Cartwright John.C.Cartwright at noaa.gov
Tue Aug 24 14:40:44 PDT 2004


Hello All,

I'm using jdom b9 and trying to find a elegant way to remove all comment 
nodes from a document.  I seem to be thrashing about though, and would 
appreciate some direction.

I've been trying approaches like:

       ContentFilter filter =  new ContentFilter();
       filter.setCommentVisible(true);
       List comments = doc.getContent(filter);
       doc.removeContent((Comment)comments.get(0));

but this seems to neither remove the comment, nor are all the comments 
in the list.

Thanks!

-- john

=====================================================
John Cartwright
Associate Scientist
Geospatial Data Services Group
CIRES, National Geophysical Data Center/NOAA
(303) 497-6284
John.C.Cartwright at noaa.gov
=====================================================



More information about the jdom-interest mailing list