[jdom-interest] Filtering comments

Rolf Lear rlear at algorithmics.com
Fri Mar 19 04:24:06 PST 2004


There is no current way to do that in JDom that I know of.

Jason, I through this through, and decided to write a new "Builder". It may
just be useful to others. Please consider it as a "contribution".

Basically I have written org.jdom.input.FilteredBuilder. The code is
attached. It is VERY simple. So simple I have not even tested it
properly....

Used like:

Document doc = new SAXBuilder().build("....document source...");
ContentFilter filter = new ContentFilter();
filter.setCommentVisible(false);
Document filtered = new FilteredBuilder(filter).build(doc);

Useful? I use Clones to do the hard work, so it is somewhat memory
expensive.

Maybe I missed something already in JDom.

Rolf

-----Original Message-----
From: Rocchi Cesare [mailto:rocchi at itc.it]
Sent: Friday, March 19, 2004 5:13 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Filtering comments


Hi,

just wondering how to filter out comments from an xml file/string.
Any idea? Browsed the archive but have not been lucky.

Thanks,

-c.
-- 
+---------------------------------------+
              Cesare Rocchi
  ITC-IRST Povo I-38050 (TRENTO) ITALY
  http://tcc.itc.it/people/rocchi.html
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FilteredBuilder.java
Type: application/octet-stream
Size: 4470 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20040319/83cba358/FilteredBuilder.obj


More information about the jdom-interest mailing list