XML - Extensible Data Format
This is a standard and universal data format. It allows to reuse a presentation for different data or use different presentations for same data.
XML, the eXtended Markup Language, is a successor for SGML. More general
than html, it incorporate data inside tags themselves and has unlimited
description capacities. The format of the display is independant, and given
by another document, the XSLT. Rules to create tags are defined by another
document, the DTD (Document Type Declaration) which describes the grammar
of the tags.
XML is processed by most programming languages through the Document
Object Model.
XHTML est a subset of XML dedicated to Web page with standard tags recognized by browsers.
XML features
- Significant tags based upon the content of data.
- Meaning of tags depends upon the content the the tool which parses the XML document.
- Separated document used for the presentation.
Sample code
An invoice in XML.
<?xml version="1.0" ?>
<!- Invoice from Scriptol.com ->
<invoice>
<order>000156</order>
<date timezone="Greenwhich">
Jan 1, 2003 14:30:00
</date>
<address>
<firstName>Sherlock</firstName>
<lastName>Holmes</lastName>
<street>5 Baker St.</street>
<city>London</city>
<state>England</state>
<zip>75004</zip>
</address>
<amount> 270 </amount>
</order>
</invoice>
Names of tags are chosen for the readability of the document, their role depends entirely on tools that will access it.
You can access an XML document in different ways
Whether to access data or to change the document, or convert it into another format, several classes of tools are used.
Parsers
There are two types of parsers. A tree parser loads the whole XML document entirely in memory, and you can then access the contents through the Document Object Model, specifically with instructions such as getElementsByTagName.
An event-driven parser on the contrary, according to the SAX API, loads the content progressively and all the data are stored, or only those that are asked.
- Xerces
A Java or C++ Parser for XML (Xerces) is distributed by the Apache group. Several other XML tools also. - LibXML
C library using the DOM or SAX APIs. - Expat library
To build a events parser (used by Scriptol and Xcheck).
XQuery
XQuery is a language for XML database query, either from a file or a database with a tree structure similar to that of XML as Apache's XIndice. It allows to create an XML database and use it.
XSLT
An XSL language is made of transformation rules. XSLT converts an XML document into another format such as HTML and can be used to access data too.
- Xalan
Transforms an XML document into HTML. There are Java and C++ versions.
Tools and documentation
- LimSee2, IDE Smil
Smil allows to describe animations in XML for the web. - XCheck
Download here a checker for well-formed XML document. - Dmoz.org
Section dedicated to XML. - xml.com
Site by O'reilly, with articles, tutorials. - Zvon.org
Tutorials to download. - Xul.fr
More XML tools and documentation on XUL, XML interface language. - XML Database
Interfacing XML and databases.
| Tweet |
|