[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] What characters can go into a CDATA section and acomment? (I found inconsistencies)
- From: Peter Flynn <peter@silmaril.ie>
- To: xml-dev@lists.xml.org
- Date: Thu, 24 Mar 2022 09:58:13 +0000
On 24/03/2022 09:18, Mukul Gandhi wrote:
On Thu, Mar 24, 2022 at 1:58 PM Peter Flynn <peter@silmaril.ie> wrote:
THE most important use case IMNSHO is for documenting markup. I like to
be able to write:
<programlisting language="XML"><![CDATA[
<?xml version="1.0">
<!DOCTYPE foo SYSTEM "bar.dtd">
<foo>
<title>Some <title></title>
</foo>
]]></programlisting>
How is above mentioned code snippet, more useful than writing within
comments like below,
<programlisting language="XML">
<!--<?xml version="1.0">
<!DOCTYPE foo SYSTEM "bar.dtd">
<foo>
<title>Some <title></title>
</foo>-->
</programlisting>
Technically, that might work, although getting it to display in a
browser without programming might be challenging. IMHO this would be a
form of tag abuse. Source code listings are not comments. There is
always a balance to be struck when settling upon a way of doing things,
to "keep the mean between the two extremes, of too much stiffness in
refusing, and of too much easiness in admitting any variation" from it.
It seems to me that, XML comments are meant to be ignored (they're sort
of noise). Is that the reason, or only reason to use CDATA section instead?
XML comments are for the author, editor, programmer, developer or other
user to be alerted to some condition that is not to be shown to the end
user, eg
<programlisting language="XML"><!--
Be aware that the DTD shown in this example
SHOULD NOT be dereferenced during processing as
it is an example only. --><![CDATA[
<?xml version="1.0">
<!DOCTYPE foo SYSTEM "bar.dtd">
<foo>
<title>Some <title></title>
</foo>
]]></programlisting>
Peter
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]