XML File Syntax Rules

This section describes 6 syntax rules of an XML file. A valid and simple XML file is also provided.

Syntax rules of an XML file:

That's it. As I said earlier, XML syntax is very simple.

A valid XML file:

<?xml version="1.0"?>
<dictionary>
<!-- valid.xml
 - Copyright (c) 2002-2018 HerongYang.com. All Rights Reserved.
-->
 <note>A valid & simple XML</note>
 <word>
  <name is_acronym="true" language="EN">POP</name>
  <definition>Post Office Protocol</definition>
  <definition>Point Of Purchase</definition>
 </word>
 <word>
  <update date="2002-12-23"/>
  <name is_acronym="yes">XML</name>
  <definition>eXtensible Markup Language</definition>
  <note>Example:
   <![CDATA[<?xml version="1.0"?><p>Hello world!</p>]]>
  </note>
 </word>
 <word>
  <update editor="Herong Yang"/>
  <name>Markup</name>
  <definition>The amount added to the cost price to calculate
the selling price - <i>Webster</i></definition>
 </word>
</dictionary>

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

 XML-JSON Document Conversion

 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

 Java Implementation of XSLT

 XSLT (XSL Transformations) Introduction

 XPath (XML Path) Language

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 PHP Extensions for XML Manipulation

 Processing XML with Python Scripts

 XML Notepad - XML Editor

 XML Tools Plugin for Notepad++

 XML Plugin Packages for Atom Editor

 XML 1.1 Changes and Parsing Examples

 Archived Tutorials

 References

 Full Version in PDF/EPUB