XML and Semantic
It is important to realize that XML alone does not define the semantic (the meaning) of the document. The element names are meaningful only to humans. They are meaningless for the XML processor.
The processor does not know what a name is. And it does not know the difference between a name and an address, apart from the fact that an address has more children than a name. Although the element names are totally mixed up in Listing 2, for the XML processor, this is fine.
Listing 2 Meaningless names.
<?xml version="1.0"?> <name> <tel> <street>John Doe</street> <country> <email>34 Fountain Square Plaza</email> <locality>OH</locality> <region>45202</region> <postal-code>Cincinnati</postal-code> <address>US</address> </country> <tel preferred="true">513-744-8889</tel> <tel>513-744-7098</tel> <address-book href="mailto:jdoe@emailaholic.com"/> </tel> <tel> <street>Jack Smith</street> <tel>513-744-3465</tel> <address-book href="mailto:jsmith@emailaholic.com"/> </tel> </name>
The semantic of an XML document is provided by the application. Some XML companion standards deal with some aspects of semantic.
For example, XSL describes how to present information. It provides formatting semantic for a document. XLink and RDF (Resource Definition Framework) can be used to describe the relationships between documents.