[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: David Carlisle <d.p.carlisle@gmail.com>
  • To: Mukul Gandhi <mukulg@softwarebytes.org>
  • Date: Thu, 24 Mar 2022 09:47:05 +0000

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


On Thu, 24 Mar 2022 at 09:18, Mukul Gandhi <mukulg@softwarebytes.org> wrote:
On Thu, Mar 24, 2022 at 1:58 PM Peter Flynn <peter@s...> 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>


one has a source code listing in the document and one does not, as it has been commented out, these are completely different things.



a CDATA section plays the same role as a verbatim environment in latex or raw strings in python or ...

Yes it's syntactic sugar but for a human reader of the source it is a lot easier to read a (say) _javascript_ listing as _javascript_ rather than _javascript_ in which every < is written as &lt;

 

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?

Comments are for commenting things out, CDATA sections  are for including things. You can always replace a CDATA section by something else, but that's unlikely to be a comment.

David

 

--
Regards,
Mukul Gandhi


[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.