[jdom-interest] remove comments

Per Norrman per.norrman at austers.se
Wed Aug 25 00:36:21 PDT 2004


from my personal tool box:

     public static void removeComments(List l) {
         for (Iterator i = l.iterator(); i.hasNext();) {
             Object node = i.next();
             if (node instanceof Comment) {
             } else if (node instanceof Element) {

     public static void removeComments(Document doc) {


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.

More information about the jdom-interest mailing list