Hi

Sorry to dredge this one up from the past.

I happened upon this discussion through a search of the issue in Google, and 
decided to summarise why I think I need to be able to wrap values in a CDATA 
Section. (I am aware of the outcome of the discussion, so please consider this 
a general comment, rather than a further request.)

I have to create output in a format that is parseable by a database load 
program we use. I had been using XML as a format for the output so I had more 
control over the character set. However, this database load program knows 
nothing about XML, just that it can detect delimiters. If I move my Java code 
to use a set of Castor-created classes, I can't load the database properly 
because the <, >, &, ", and ' characters won't be treated specially during 
database load.

Hence, CDATA Sections.

Cheers,
Ben

Ralf Joachim wrote on Tue, 21 Mar 2006 11:45:33 -0800

> Hi Marc,
>
> before writing your own serializer why not add this feature to Castor. I can
> think of a mapping attribute that selects if a value is embedded in a cdata
> section. As we have access to the serializer anyway, we can write the cdata
> instead of the none escaped value to it.
>
> Having said that others have requested this in the past as far as I remember.
>
> Regards
> Ralf
> 
> Marc Respass schrieb:
> On Mar 21, 2006, at 2:14 PM, Benoit Maisonny wrote:
>
> > I'm curious to know why you need to put the values in CDATA sections.
> 
> So am I. I'm making an XML file that is sent to someone and that's what they
> require. When I asked why, they ignored me.
>
> > The serializer escapes anyway any character that need to be escaped 
> > according
> > to XML specs (if not, than the serializer is buggy). So, I don't see a need
> > to use CDATA at all. 
> 
> I couldn't agree more. Besides that, the data is all simple short  values.
>
> > As far as I know, CDATA sections are only useful to humans, as we don't like
> > to have to escape characters manually. But maybe I miss some weird use of
> > CDATA. 
>
> CDATA is sometimes useful and I've used it before but this is not a good use 
> of
> CDATA. Frankly, I suspect the guys who are receiving this file are using
> String.indexOf() as their parser ;).
> 
> However, one may desire enclosing a value in CDATA and it seems like something
> useful to have. I've found a number of questions about how to go about it and
> none of the answers are very easy. I was hoping there was something that I
> missed in Castor but it looks like writing my own serializer is the way.
>
> Marc

--
Ben Richardson
w=http://science.dec.wa.gov.au/people/?sid=98
[EMAIL PROTECTED] tz=AWST (UTC+8)
t=+61 8 9334 0511 f=+61 8 9334 0515

This email, together with any attachments, is intended for the
addressee only. It may contain confidential or privileged information.
If you are not the intended recipient of this email, please notify
the sender, delete the email and attachments from your system and
destroy any copies you may have taken of the email and its attachments.
Duplication or further distribution by hardcopy, by electronic means
or verbally is not permitted without permission.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to