Absolute Beginner's XML Tutorial and Resources

This page is in its infancy, so please forgive me if there are lots of errors and omissions!

XML Fundamentals

XML (eXtensible Markup Language) is not a programming language.  Like HTML (and sharing a common parentage - but that's another story), XML is a means of 'marking up' the content of a document using elements (sometimes referred to as tags) to mark the beginning and end of sections of information.

Like in HTML, those elements begin with a '<' sign and end with a '>'.

Also like in HTML, the element which denotes the END of a piece of information (the CLOSING tags) differs from the element which BEGINS a piece of information (the OPENING tags) by having a forward slash before the tag name.

Here's an example:

<Name>John Smith</Name>

XML documents can contain an indefinite number of elements, but the elements must be nested correctly, for instance:

<Player> <Name>John Smith</Name> <Position>Attack</Position> </Player>

Statements like these make up what's usually referred to as the BODY of the XML document.

Elements can be nested (as above) but may not overlap.

An XML document will often also contain what's called the Prolog, a part of the document which can include an XML declaration statement, document type declaration (usually referred to as a DTD), comments and other processing instructions.

The XML declaration

Here's an example of an XML declaration:

<?xml version="1.0" encoding="UTF-8" ?>

This has to go right at the start of the XML document, without even white space before it.  The "version" attribute is compulsory, while "encoding" is one of the optional ones.  For a full list of the XML specifications, see the W3C recommendations

An XML document which fulfills all of these rules is called a 'well formed' XML document.

The Data Type Definition or DTD

The DTD, contained in the XML document or referred to in a separate file from within the XML document, gives a specification for the XML document in terms of element definitions, their heirarchical relationships, default values and so forth.

A well formed XML document which refers correctly to a DTD is said to be a Valid XML Document.

Dealing with XML Documents

Although their detailed description is beyond the scope of this brief tutorial, there are many tools and applications available to help you to manipulate XML documents. 

Among them are XML parsers (tools to interpret XML documents and recover the information they contain for use in other applications), XML Editors (for creating, editing and validating XML documents) and transformation tools (to convert XML documents into other formats such as text or HTML, usually using XSL, the XML Stylesheet Language).

See the links on this page for examples.


An open source XML Parser for use with PHP

XML Edit Pro
A freeware XML Editor

A freeware debugger for XSL stylesheets


Think this may help others? Please share ...Google+FacebookPinterestStumbleUponLinkedInTwitter

Site Map Page loaded in 0.27637 sec
© 2005 The Mouse Whisperer | Cookies