Processing XML with Perl | Michel Rodriguez |
More on the XML recommendation (cont'd) | Examples of XML applications |
More on the XML recommendation (cont'd)
Namespaces
namespaces are a way to reuse parts of possibly third-party XML structures without getting into re-definition problems.
<h:html xmlns:my="http://www.my.com/my.namespace" xmlns:h="http://www.w3.org/HTML/1998/html4"> <h:head><h:title>Book Review</h:title></h:head> <h:body> <my:wine> <my:title>Ginestet Marquis de Chasse Reserve</my:title> <h:table> <h:tr align="center"> <h:td>Year</h:td><h:td>Rating</h:td> <h:td>Stock</h:td><h:td>Price ($)</h:td></h:tr> <h:tr align="left"> <h:td><my:year>1997</my:year></h:td> <h:td><my:rating>9</my:rating></h:td> <h:td><my:stock>100</my:stock></h:td> <h:td><my:price>10</my:price></h:td> </h:tr> </h:table> </my:wine> </h:body> </h:html> |
- still controversial (DTD's cannot deal with namespaces)
- the namespace prefix is not significant, the URI is but...
- the URI is not linked to anything, it is just a way to create a unique string
More on the XML recommendation (cont'd) | Examples of XML applications |