[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: What characters can go into a CDATA section and acomment?

  • From: Peter Flynn <peter@silmaril.ie>
  • To: xml-dev@lists.xml.org
  • Date: Thu, 24 Mar 2022 09:58:13 +0000

Re:  What characters can go into a CDATA section and acomment?
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 &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>
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 &lt;title></title>
</foo>
]]></programlisting>

Peter


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.