Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
The term
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
by Valeri Tandilashvili
4 years ago
0
XML
XML CDATA
XML Tutorial
0
Rules that should be followed when we use XML comments:
- 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.
by Valeri Tandilashvili
4 years ago
0
XML
XML comments
XML Tutorial
0
XML comments
Similar to HTML comments, XML comment has the following syntax:
<!-- 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>
by Valeri Tandilashvili
4 years ago
0
XML
XML comments
0
- An element name can contain any alphanumeric characters. Allowed
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
by Valeri Tandilashvili
4 years ago
0
XML
XML elements
XML Tutorial
0
The symbols: hyphen
-
, 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>
by Valeri Tandilashvili
4 years ago
0
XML
XML elements
XML Tutorial
0
XML empty tags
An empty element in XML document can be represented in two ways:
<?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.
by Valeri Tandilashvili
4 years ago
0
XML
XML tags
0
XML tags are
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>
by Valeri Tandilashvili
4 years ago
0
XML
XML tags
XML Tutorial
0
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)
by Valeri Tandilashvili
4 years ago
0
XML
XML declaration
XML Tutorial
0
XML references allow us to have symbols in XML text, that are not allowed to be included directly. References begin with the symbol
&
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
&amp;
where amp is name. The name refers to
&
symbol. ... 2.
Character Reference
− contains reference, such as
&#65;
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
by Valeri Tandilashvili
4 years ago
0
XML
XML Tutorial
0
Some characters are are not allowed in XML text because they are reserved by the XML itself. Hence, they cannot be used directly. If we need to include them in text, some replacement-entities are used. These symbols are:
<
- less than -
&lt;
>
- greater than -
&gt;
'
- ampersand -
&amp;
"
- apostrophe -
&apos;
&
- quotation mark -
&quot;
by Valeri Tandilashvili
4 years ago
0
XML
XML Tutorial
0
Results: 1578