Re: [xml-dev] What characters can go into a CDATA section and a comment? (I found inconsistencies)

From
Mukul Gandhi <>
To
Peter Flynn <>
Date
2022-03-24T09:18:13Z
ID
<>
Thread
Re: [xml-dev] What characters can go into a CDATA section and a comment? (I found inconsistencies)
On Thu, Mar 24, 2022 at 1:58 PM Peter Flynn <[email protected]> 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 &lt;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 &lt;title></title>
</foo>-->
</programlisting>

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?
 

--
Regards,
Mukul Gandhi