users@jaxb.java.net

Re: CDATA sections creation

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 27 Feb 2003 09:16:45 -0800

You can't really say "I expect this element to contain CDATA" with any
of the schema language available today AFAIK.

So I'm afraid there's no easy solution for you.

The easy way to do it is

    1. marshal to a DOM tree
    2. modify DOM tree and change Text nodes to CDATASection nodes
    3. save DOM

This is easy to implement but slower.
The harder but faster way is

    1. Pick up a free XMLWriter. Search the list archive for information
       about various XMLWriters that I and other people recommended.
    2. modify it so that it recognizes the "mysection" element and print
       its contents in CDATA.

Hope it helps.

regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com