Hi Arnaud,

Thanks for the suggestion.
I've been able to use AnyNode (and <xsd:any>) for variable xml blocks and it
works like a charm.
Unfortunately this doesn't work with CDATA.

When unmarshalling text with CDATA (into the <xsd:any> container class), the
actual text gets escaped and the CDATA tag gets lost. No differences with
<xsd:text> here (OK, I had to try unmarshal).

When populating a AnyNode element with AnyNode text (CDATA), the text gets
escaped during marshalling. Funny enough, in this case the CDATA tag remains
but the enclosing '<' and '>' are translated.

I'm using a (dirty) hack now: The element is of type text, I fill it with a
dummy and replace the dummy with the "real" data after marshalling.
I'm still very curious if I can get CDATA to work, but at least the pressure
is off for the moment.

Thanks for your suggestions (everybody!),
 Michel

-----Oorspronkelijk bericht-----
Van: Arnaud Blandin [mailto:[EMAIL PROTECTED]]
Verzonden: dinsdag 31 juli 2001 12:13
Aan: [EMAIL PROTECTED]
Onderwerp: Re: [castor-dev] Please Help! Need CDATA


Actually there is no specific support for CDATA  sections.
When it was supported by XML Schema, we used to map it to
a Java string.
For your problem, you might want to use an AnyNode and the xsd:any in your
XML Schema.

Hope this helps,

Arnaud
> -----Original Message-----
> From: Ozgur Balsoy [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 27, 2001 9:29 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] Please Help! Need CDATA
>
>
> I had a similar problem with CDATA sections. It looks like there is no
> support for CDATA in Castor (or I could not find any help).
> Besides, xsd:CDATA is removed from the final XML Schema recommendation.
>
> As a solution, you can make your element a 'xsd:string' and set
> white space
> facet to 'preserve'. Two drawbacks:
> - you cannot use indentation feature for marshalling.
> - '<' '>' and other special characters are translated into &lt; &gt; etc.
>
> Hope this helps.
>
> Ozgur Balsoy
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> > Michel Smits
> > Sent: Friday, July 27, 2001 8:56 AM
> > To: [EMAIL PROTECTED]
> > Subject: [castor-dev] Please Help! Need CDATA
> >
> >
> > Hello there,
> >
> > I've already posted this question (slightly different) but I must make a
> > decision whether or not to continue with Castor... (the
> > alternatives do not
> > look that great but..)
> >
> > When using Castor-J (0.9.3 and Xerces 1.4.2) xml binding, do
> the generated
> > classes support CDATA text???
> >
> > The reason for this is I have an element containing unformatted HTML.
> > So far, I keep losing the <![CDATA[..]]> tag (possibly causing
> > errors during
> > marshalling).
> > To test this, unmarshal and then marshal an xml document
> > (containing CDATA).
> >
> > Thanks,
> >  Michel Smits
> >  [EMAIL PROTECTED]
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> >     unsubscribe castor-dev
> >
> >
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>       unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to