dictionary.xml - A Simple XML Sample File
This section provides a tutorial example of a simple XML sample file with two repeating elements in the root element.
Here is a simple XML sample file that represents a glossary with only two words defined:
- Copyright (c) 1999-2002 HerongYang.com, All Rights Reserved.
<definition reference="Herong's Notes">eXtensible Markup
<definition>Mathematical symbol representing the "less than" logical
operation, like: 1<2.</definition>
<definition>Reserved symbol in XML to representing the beginning of
tags, like: <![CDATA[<p>Hello world!</p>]]>
- A multiple-line comment is used to show the copyright information.
- "dictionary" is the root element.
- Attributes are used in elements: "word", "definition" and "update".
- "update" is an empty element with no content.
- "word" is a nested element, and repeated twice.
- Entity "'" is used in attribute "reference".
- Entity "<" is used in contents of elements "name" and "definition".
- CDATA section is used in the second "definition" of the second "word", in
which "<p>" and "</p>" will not be considered as XML tags any more.
Since XML file don't care about how the tags should be named and what information
they should be carrying, we can re-organize the same information in many ways.
- We could move the information from the "date" attribute of "update" element
into the content, and rewrite the "update" like:
- We could also move content into an attribute, like:
<name is_acronym="true" value="XML"/>
The choice is total up to the providers and consumers of the information to define
an agreed structure.
Last update: 2002.
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
Full Version in PDF/EPUB