What is XML ?

XML, the Extensible Markup Language, is a standardized data format. It looks a little like HTML, with tags and entities (&). Unlike HTML, however, XML is designed to be easy to programmatically parse, and there are rules for what you can and cannot do in an XML document. XML is now the standard data format in fields as diverse as publishing, engineering, and medicine. It’s used for remote procedure calls, databases, purchase orders, and much more

Lightning Guide to XML

<book isbn="1-56592-610-2">
 <title>Programming PHP</title>
 <authors>
 <author>Rasmus Lerdorf</author>
 <author>Kevin Tatroe</author>
 <author>Peter MacIntyre</author>
 </authors>
</book>

In XML, that is illegal. XML requires that every open tag be closed. For tags that don’t enclose anything

XML adds this syntax:

<br />

Tags can be nested but cannot overlap. For example, this is valid:

Invalid XML

<book><title>Programming PHP</title></book>

valid XML

<book><title>Programming PHP</book></title>

XML also requires that the document begin with a processing instruction that identifies the version of XML being used (and possibly other things, such as the text encoding used). For example:

<?xml version="1.0" ?>

The final requirement of a well-formed XML document is that there be only one element at the top level of the file. For example, this is well formed:

<?xml version="1.0" ?>
<library>
 <title>Programming PHP</title>
 <title>Programming Perl</title>
 <title>Programming C#</title>
</library>

Leave a Comment