CDATA means, Character Data. CDATA is defined as blocks of text that are not parsed by the parser, but are otherwise recognized as markup<?xml version="1.0" encoding="UTF-8"?>
<student>
<!-- Some comment about the student -->
<first-name>George</first-name>
<phone.mobile>(011) 123-4567</phone.mobile>
<city />
<description>
<![CDATA[
<p>
<a href="/mylink/article1"><img style="float: left; margin-right: 5px;" height="80" src="/mylink/image" alt=""/></a>
Author Names
<br/><em>Date</em>
<br/>Paragraph of text describing the article to be displayed</p>
]]>
</description>
</student>
CDATA Start section - CDATA begins with the nine-character delimiter <![CDATA[
CDATA End section - CDATA section ends with ]]> delimiter
CData section - Characters inside CData section are interpreted as characters, and not as markup.
It may contain markup characters <, >, and &, but they are ignored by the XML processor- Comment must appear after XML declaration.
- Comment may appear anywhere in a document
- Comment must not appear within attribute values.
- Comment cannot be nested inside the other comment.<!-- Our comment -->
XML comment example in XML document:<?xml version="1.0" encoding="UTF-8"?>
<student>
<!-- Some comment about the student -->
<first-name>George</first-name>
<phone.mobile>(011) 123-4567</phone.mobile>
<tive_language>English</tive_language>
<another_tag>some text</another_tag>
<city />
</student>symbols in names are the hyphen -, under-score _, period . and digits 0-9
- Names are case sensitive, Address, address, and ADDRESS are different names.
- Start and end tags of an element must be the same.
- An element, which is a container, can contain text or elements <?xml version="1.0" encoding="UTF-8"?>
<student>
<first-name>George</first-name>
<phone.mobile>(011) 123-4567</phone.mobile>
<native_language>English</native_language>
<city />
</student>
Note: XML element name must not start with ., -, digit-, under-score _ and period . are allowed in element name. The XML example is valid<?xml version="1.0" encoding="UTF-8"?>
<student>
<first-name>George</first-name>
<phone.mobile>(011) 123-4567</phone.mobile>
<native_language>English</native_language>
<city />
</student><?xml version="1.0" encoding="UTF-8"?>
<student>
<name>George</name>
<phone>(011) 123-4567</phone>
<address></address>
<city />
</student>One way is <address></address> element and another is <city />. In other words, one with closing tag and another is self-closing tag.case-sensitive - because of the case difference in two tags, which is treated as incorrect syntax in XML<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<student>
<name>George</name>
<city>Tbilisi</city>
<phone>(011) 123-4567</phone>
<address>Wrong syntax</ADdress>
<hr />
</student>This will generate the error:error on line 6 at column 23: Opening and ending tag mismatch: address line 0 and ADdress
XML tags must be closed in an appropriate order, which means an XML element opened inside another element must be closed before the outer element<outer_element>
<internal_element>
Right, because the inner tag is closed before the outer
</internal_element>
</outer_element>version - specifies the version used in the XML document (1.0)
encoding - defines the character encoding used in the XML document (UTF-8)
standalone - if the value is yes it means there is no external declaration required to parse the document (yes)& which is a reserved character and end with the symbol ;
XML has two types of references:
...
1. Entity Reference − which contains a name between the start and the end delimiters.
For example & where amp is name. The name refers to & symbol.
...
2. Character Reference − contains reference, such as A contains a hash mark # followed by a number.
The number refers to the Unicode code of a character. In this case, 65 refers to alphabet A< - less than - <
> - greater than - >
' - ampersand - &
" - apostrophe - '
& - quotation mark - "