The Need for Namespaces
Some documents combine markup from multiple XML applications. For example, an XHTML document may contain both SVG pictures and MathML equations. An XSLT stylesheet will contain both XSLT instructions and elements from the result-tree vocabulary. And XLinks are always symbiotic with the elements of the document in which they appear since XLink itself doesn’t define any elements, only attributes.
In some cases, these applications may use the same name to refer
to different things. For example, in SVG a set element sets the value of an attribute
for a specified duration of time, while in MathML, a set element represents a mathematical set
such as the set of all positive even numbers. It’s essential to know
when you’re working with a MathML set and when you’re working with an SVG
set. Otherwise, validation,
rendering, indexing, and many other tasks will get confused and
fail.
Consider Example 4-1. This is a simple list of paintings, including the title of each painting, the date each was painted, the artist who painted it, and a description of the painting.
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <catalog> <painting> <title>Memory of the Garden at Etten</title> <artist>Vincent Van Gogh</artist> <date>November, 1888</date> <description> Two women look to the left. A third works in her garden. </description> </painting> <painting> <title>The Swing</title> <artist>Pierre-Auguste Renoir</artist> <date>1876</date> ...