Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Control output of CDATA sections

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: "Hughes, Rob" <hughes AT fgm.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Control output of CDATA sections
  • Date: Fri, 8 Dec 2006 12:34:03 -0800

If the receiving side of the pipe can't be fixed, a work-around would be to use the StreamingStaxSerializer class in combination with a StAX implementation such as woodstox. It converts XOM's CDATASection objects to StAX character events, which correspond to XOM text nodes. A benefitial side effect of doing so with woodstox would be that serialization is at least twice as fast as with the normal nu.xom.Serializer (measured using no pretty printing).

See http://dsd.lbl.gov/nux/api/nux/xom/io/StreamingSerializer.html

Example usage:

nu.xom.Document doc = ...
OutputStream out = ...
XMLStreamWriter writer = XMLOutputFactory.newInstance ().createXMLStreamWriter(out, "UTF-8");
StreamingSerializer ser = new StreamingSerializerFactory ().createStaxSerializer(writer);
ser.write(doc);
out.close();

Wolfgang.

On Dec 8, 2006, at 6:51 AM, Hughes, Rob wrote:

Is there a property on the XOM serializer to instruct it not to output
CDATA sections?

I have an application where the XML instance documents are not allowed
to contain CDATA sections. As a result, it is important for me control
this aspect of the serializer.

--Thank You, Rob
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest





Archive powered by MHonArc 2.6.24.

Top of Page