[jdom-interest] remove comments
jhunter at xquery.com
Tue Aug 24 15:21:24 PDT 2004
If you want the output to have no comments, just override XMLOutputter's
printComment() method to be a no-op.
To make a live change, you need to recurse. Your code below only does
one level. There was easy recursion added I think in b10, but you can
do it yourself easily enough.
John C Cartwright wrote:
> 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();
> List comments = doc.getContent(filter);
> but this seems to neither remove the comment, nor are all the comments
> in the list.
> -- john
> John Cartwright
> Associate Scientist
> Geospatial Data Services Group
> CIRES, National Geophysical Data Center/NOAA
> (303) 497-6284
> John.C.Cartwright at noaa.gov
> To control your jdom-interest membership:
More information about the jdom-interest