>> English << | česky | Español | Português | Türkçe | Nederlands | По-русски | Deutsch | Français | Italiano | 中文 | ქართული | Magyar | Polski ZVON > Tutorials > XML Tutorial


Contents

 Example 1  XML document must contain one or more elements.
 Example 2  There is exactly one element, called the root, or document element, no part of which appears in the content of any other element.
 Example 3  The name in an element's end-tag must match the element type in the start-tag. Names are case-sensitive
 Example 4  If the start-tag is in the content of another element, the end-tag is in the content of the same element. More simply stated, the elements, delimited by start- and end-tags, nest properly within each other.
 Example 5  The end of every element that begins with a start-tag must be marked by an end-tag containing a name that echoes the element's type as given in the start-tag. The text between the start-tag and end-tag is called the element's content. An element without content can take a special form: <name/> . The slash before > substitutes the end tag.
 Example 6  Element names can contain letters, digits, hyphens, underscores, colons, or full stops. A colon can be used only in a special case where it separates so called namespace. Element names starting with xml, XML or other combination of cases of this string are reserved for the standard.
 Example 7  An element can have none, one or several attributes. Permitted characters are the same as for element names. The name of attribute is separated from its value by =. The attribute value must be given inside apostrophes '...' or double-quotes "..." . If an apostrophe or double-quote is used in the attribute value the opposite delimiter must be used.
 Example 8  Characters < and & cannot be used in text as they are used in markup. If these characters are needed &lt; must be used insted of < and &amp; instead of &
 Example 9  Characters >, " , and ' can be also substituted by &gt; , &quot; and &apos; , respectively
 Example 10  Comments may appear anywhere in a document outside other markup. An XML processor may, but need not, make it possible for an application to retrieve the text of comments. The string "--" (double-hyphen) must not occur within comments.
 Example 11  Processing instructions (PIs) allow documents to contain instructions for applications.
 Example 12  CDATA sections are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string "<![CDATA[" and end with the string "]]>". The string ']]>' must not occur inside CDATA section.
 Example 13  XML documents may, and should, begin with an XML declaration which specifies the version of XML being used.