Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] CDATA sections

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <jcowan AT reutershealth.com>
  • To: Arjan Huijzer <huijzer AT gmail.com>
  • Cc: XOM-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] CDATA sections
  • Date: Tue, 4 Jan 2005 09:58:09 -0500

Arjan Huijzer scripsit:

> I was wondering what the best way was to generate the CDATA section with
> XOM.

The obvious approach is to subclass Serializer and override the
write(Text t) method, somewhat as follows:

write(Text t) {
if (cdata_wanted()) {
writeRaw("<![CDATA[");
writeRaw(t);
writeRaw("]]>");
}
else
super.write(t);
}

You will probably need to override writeStartTag as well in order
to be able to figure out which element you are in and whether you
want to generate a CDATA section for it.

--
I suggest you call for help, John Cowan
or learn the difficult art of mud-breathing. jcowan AT reutershealth.com
--Great-Souled Sam http://www.ccil.org/~cowan




Archive powered by MHonArc 2.6.24.

Top of Page