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: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: John Cowan <jcowan AT reutershealth.com>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] CDATA sections
  • Date: Thu, 03 Feb 2005 14:33:53 -0500

John Cowan wrote:


This can only be done if Serializer exposes a public or protected
interface that allows you to ask if a character is directly encodable
in the current encoding. Characters that can't be, can't be in CDATA
sections.

There's no magic in XOM for figuring out what is and isn't representable. If you're subclassing Serializer, you're going to know what encoding you're using because you either have to use UTF-8 or pass something different to the superclass constructor. In this case, you can figure out what characters need to be escaped and which don't be, probably a lot more simply than XOM does since most use cases will only need one encoding rather than essentially any encoding. Alternately, you could just use the Java 1.4 classes to figure this out. I wasn't willing to depend on Java 1.4 for XOM itself, but subclasses could easily do that.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page