[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Question about XML

Posted on 2011-10-25
10
Medium Priority
?
221 Views
Last Modified: 2012-08-13
Please explain the name of this format and what exactly it means?

<![CDATA[Mobile]]>

Thanks.
0
Comment
Question by:newbieweb
  • 4
  • 3
  • 2
9 Comments
 
LVL 9

Assisted Solution

by:Tehzar
Tehzar earned 400 total points
ID: 37024505
The term CDATA comes from the SGML world, which is the complex predecessor of XML and was used to describe the original HTML 2, 3 and 4 specifications. The term is short for Character Data and means that the data contains of characters, and should not be parsed. Tags, entities, attributes, processing instructions inside CDATA are treated as text, not as XML elements.

For more information, please have a look at this link:

http://www.undermyhat.org/blog/2009/09/understanding-cdata-in-xml/
0
 

Author Comment

by:newbieweb
ID: 37024811
Thanks!
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 1600 total points
ID: 37024866
put simple:
 a "CDATA section"  is a special text node that allows you to put special XML characters in a text node without escaping them
Important to realize is that it is  a text node
Note that there is not necessarily a relation with SGML's "CDATA", see below
see my example in code pane

I have some observations with Tehzar's answer
well, allthough not really wrong this definition is a bit weird.
In XML everything stems from SGML, so also the term "CDATA" does, as does "element", "attribute", "entity", "DTD", "PCDATA"
Most of these terms did not suffer the same amount of changes going from SGML to XML, as CDATA does
and CDATA as element content has vanished. (In HTML there is a SCIPT tag that is declared by DTD to be CDATA, meaning CDATA section without the start and end indicator, but that is no longer allowed in XML)
What you are looking at is a CDATA SECTION, CDATA, but with explicit markers

Where your definition goes wrong is with the HTML specs. reference
HTML2, HTML3 and HTML4 had perfectly valid SGML DTDs, they just required some changes to the reference concrete syntax in the SGML declaration
So that part of your definition is simply wrong .
What makes CDATA sections usefull in XML for HTML? an IMG does not need closure in HTML, it does not in SGML (html is perfectly valid SGML and SGML allows end tag omissions), but is not valid XML, wince XML does not allow end tage omission. So it is convenient to stuff an piece of HTML as a textnode in a CDATA section (personally I hate that)

Note that he full refrence you posted has many inconsistencies like this one
<foo><![CDATA[special & < > without escaping]]></foo>

is exactly the same in XML terms as

<foo>special &amp; &lt; &gt; without escaping</foo>

It is a convenience to help you type element content fast that contains a lot of sensitive characters
so it is (ab)used a lot for putting html inside xml
(which often is an error becaus eyou loose structure, you flatten the html to a text node)

<foo><![CDATA[<p>bar</p>]]></foo>

is equal to

<foo>&lt;p&gt;bar&lt;/p&gt;</foo>

BUT IS NOT EQUAL TO (WARNING!)

<foo><p>bar</p></foo>

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 60

Expert Comment

by:Geert Bormans
ID: 37024868
please note that you accepted an answer that is not correct :-)
0
 

Author Comment

by:newbieweb
ID: 37028737
I have requested the question be re-opened so Tehzar can defend his answer or lose the points to Gertone.

http://www.experts-exchange.com/Community_Support/General/Q_27415479.html

Thanks,
newbieweb
0
 

Author Closing Comment

by:newbieweb
ID: 37028834
Thanks for the clarification.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 37029308
welcome
0
 
LVL 9

Expert Comment

by:Tehzar
ID: 37030399
I didn't realize this was going to turn into a dance off...however, if you would have followed the link supplied earlier, you would have found that it validates my answer.

cheers

ZaR
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 37030526
Hi ZaR,

Of course I did follow the link, and read it in detail up to the end. I would not comment on an article without absorbing its content.
I actually know the author in person, so I bet we will have a discussion soon about the flaws in the article,
I think he realises there are some, note this at the top of the current version of his article:
"Update: this post is under review and is being rewritten, it may change without notice. This notice will disappear when the rewrite is over."
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses
Course of the Month19 days, 12 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question