XML Tutorials - Herong's Tutorial Examples - v5.23, by Herong Yang
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:
<?xml version="1.0"?> <!-- dictionary.xml - Copyright (c) 1999-2002 HerongYang.com. All Rights Reserved. --> <dictionary> <word acronym="true"> <name>XML</name> <definition reference="Herong's Notes">eXtensible Markup Language.</definition> <update date="2002-12-23"/> </word> <word symbol="true"> <name></name> <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>]]> </definition> </word> </dictionary>
Note that:
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. For example:
The choice is total up to the providers and consumers of the information to define an agreed structure.
Table of Contents
Introduction of XML (eXtensible Markup Language)
Types of Information in XML Files
The <?xml ...?> Processing Instruction
►dictionary.xml - A Simple XML Sample File
DOM (Document Object Model) Programming Interface
SAX (Simple API for XML) Programming Interface
DTD (Document Type Definition) Introduction
Validating an XML Document against the Specified DTD Document Type
XSD (XML Schema Definition) Introduction
Validating XML Documents Against Specified XML Schemas
XSL (Extensible Stylesheet Language) Introduction
XSLT (XSL Transformations) Introduction
XSLT Elements as Programming Statements
Control and Generate XML Element in the Result
PHP Extensions for XML Manipulation
Processing XML with Python Scripts
XML Tools Plugin for Notepad++
XML Plugin Packages for Atom Editor