Types of Information in XML Files

This section describes 6 types of information in an XML file: Processing Instruction, Comment, XML Element, Mixed Text, XML Entity, and CDATA Section.

There are 6 types of information in an XML file:

1. Processing Instruction: Used to pass an instruction to applications that processing this file. Processing instructions are written in the following syntax:

<?target instruction?>

where "target" is the name of a target group of applications expected to use this instruction, and "instruction" is the actual instruction to be passed to those applications.

2. Comments: Used only to comment the XML file. Comments will be ignored by application that processing this file. Comments are written in the following syntax:

<!--comment-->

where "comment" is the text of comment.

3. XML Elements: Used to present a unit of information, with a name, an optional body, and optional attributes. Elements are written in the following syntaxes:

<tag/>
<tag attributes/>
<tag>content</tag>
<tag attributes>content</tag>

where "tag" is the name of the element, "content" is a string of text, or text mixed with XML elements, and "attributes" is one pair of name and value or a list of multiple pairs of name and value written in the following syntax:

name="value"
name_1="value 1" name_2="value 2" ... name_n="value n"

4. Mixed Text: A string of text, or text mixed with XML elements, used as contents of elements. Examples of mixed text:

This mixed text only contains characters.
This mixed text <br/>contains characters and <b s="1">elements</b>.
This mixed text contains entities, &amp;, &lt;</b>.

5. XML Entities: Special escape sequences to represent XML reserved characters. XML entities can be used in element content and attribute values. These are XML pre-defined entities and reserved characters they are representing:

Entity   Character

&amp;    &
&apos;   '
&gt;     >
&lt;     <
&quote;  "

5. CDATA Section: A section of text in which any XML reserved characters should be treated as normal characters. CDATA sections are written in the following syntax:

<![CDATA[
text line
...
]]>

Table of Contents

 About This Book

 Introduction of XML (eXtensible Markup Language)

XML File Syntax

Types of Information in XML Files

 XML File Syntax Rules

 The <?xml ...?> Processing Instruction

 dictionary.xml - A Simple XML Sample File

 XML File Browsers

 DOM (Document Object Model) Programming Interface

 SAX (Simple API for XML) Programming Interface

 DTD (Document Type Definition) Introduction

 Syntaxes of DTD Statements

 Validating an XML Document against the Specified DTD Document Type

 XSD (XML Schema Definition) Introduction

 Syntaxes of XSD Statements

 Validating XML Documents Against Specified XML Schemas

 XSL (Extensible Stylesheet Language) Introduction

 XSLT (XSL Transformations) Introduction

 Java Implementation of XSLT

 XPath (XML Path) Language

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 XML Notepad - XML Editor

 XML Tools Plugin for Notepad++

 XML 1.1 Changes and Parsing Examples

 Outdated Tutorials

 References

 PDF Printing Version