Namespaces and SAX2
However you use XML namespaces with SAX, you need to understand the core concepts discussed in this section. Namespaces can be confusing; they’re more complex than perhaps they ought to be. In part this is because of how they interact (or don’t interact) with other parts of Greater XML; in part it’s because everyone has different ways to a determine what words mean, and XML names are kinds of words. We’ll look at some of those complexities first, and then at the mechanisms SAX2 has to help you deal with them.
But first, just what are namespaces supposed to do?
Usually, they identify some particular technical vocabulary.
People often reuse words rather than create new ones,
and they acquire context-specific meanings and nuances that
can be extremely important.
A namespace can distinguish whether a word like “bill” refers to
part of a bird, a now-archaic weapon, part of a hat,
legislative acts, or a number of other things.
<bill length='45cm'/> element might
be associated with a namespace, which provides context that should help
applications interpret the element.
A processor for “Birder’s Markup Language” could know to reject
(or ignore) markup intended for legislative or financial uses,
even if they all use “bill” elements.
XML defines a way to declare namespaces as needed, using
attributes. Namespaces are usually indicated by a prefix,
which can serve as a qualifying adjective: “the bird’s bill” might be
bird:bill while “the consultant’s bill” might be ...