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: Arjan Huijzer <huijzer AT gmail.com>
  • To: XOM-interest AT lists.ibiblio.org
  • Cc:
  • Subject: Re: [XOM-interest] CDATA sections
  • Date: Wed, 5 Jan 2005 09:06:11 +0100

Just to clarify my reasons. I wanted to use the CDATA section, because:

1. The content of my article would be added by the users that may (or
may not) choose to add some HTML to it. But it might very well not be
well-formed XML and I do not want to place that restriction on them.
So I find mixed content not desirable, because it would mean I have to
parse the HTML and create well-formed XHTML from it.

2. In the current situation, all '<' and '>' characters are escaped
into '&lt;' and '&gt;'. Although this does work fine, I find my XML
to be not easily readable.

Therefor, I would prefer:

<article>
<content>
<![CDATA[
<h1>My Title</h1>
<para>Some text</para>
<para>Some more text</para>
]]>
</content>
</article>

to:

<article>
<content>
&lt;h1&gt;My Title&lt;/h1&gt;
&lt;para&gt;Some text&lt;/para&gt;
&lt;para&gt;Some more text&lt;/para&gt;
</content>
</article>

Thanks for all your help and remarks so far!


On Tue, 4 Jan 2005 14:00:44 -0500, John Cowan <jcowan AT reutershealth.com>
wrote:
> Elliotte Harold scripsit:
>
> > >As long as there is no DTD, then a CDATA seems unecessary.
> > >
> > >But if there is a DTD and it does not allow mixed content for <content>,
> > >then a CDATA section would effectively sidestep validation issues...
> >
> > Again, you are asking to do exactly what I maintain is a horrible idea.
> > Content in CDATA is *not* markup , even if it looks like it is.
>
> I agree. The proper use of CDATA (and the use I was making of it) was to
> write character data that happens to contain lots of < characters in such
> a way that it remains readable.
>
> IOW, the end result was to display the snippets of HTML *as* HTML, not
> render them.
>
> --
> John Cowan jcowan AT reutershealth.com www.reutershealth.com ccil.org/~cowan
> Dievas dave dantis; Dievas duos duonos --Lithuanian proverb
> Deus dedit dentes; deus dabit panem --Latin version thereof
> Deity donated dentition;
> deity'll donate doughnuts --English version by Muke
> Tever
> God gave gums; God'll give granary --Version by Mat McVeagh
> _______________________________________________
> 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