[XML-SIG] Looking for namespace examples...

Greg Stein gstein@lyra.org
Mon, 19 Apr 1999 00:43:19 -0700

Stuart Hungerford wrote:
> This one is a bit more prosaic: I'm looking for some
> realistic examples of DTD's and XML documents that
> make use of namespaces.

Not very realistic, but it provides numerous examples: the XML
Namespaces specification.


A realistic application of namespaces can be seen in the WebDAV


> My understanding is that a validating parser will not
> treat namespace prefixes as "special" in any way in
> a DTD.

If a validating parser does not understand namespaces, then it will not
be able to validate an XML document that uses them. For example, it sees
"<foo:bar/>" and "<bar/>" as different elements, and no fudging of the
"foo" prefix will fix that. The only workaround is to use a default
namespace for the WHOLE document so that the DTD refers to <bar/> and
the document uses <bar/> (and the element in the doc falls into the
appropriate namespace via an xmlns="..." attribute). Note that this
implies only one namespace per document.

> I've seen short examples where the xmlns:foo
> attribute is defined as a FIXED attribute (in David
> Megginson's "19 questions" document), and now
> I'm a bit confused.

I'm not familiar with DTD terminology, so I don't know what FIXED is
attempting to state.

> Can anyone point me to some good learning
> examples?

Hopefully the two docs above will provide ample information. I posted a
module to this list a couple weeks ago which will properly and quickly
parse XML documents with namespaces (I don't believe the xml package has
a parser/DOM capable of doing so, although it appears Python's xmllib.py
can (albeit slowly)). My module is available at:


Note that it is based on top of pyexpat, so you'll need that module,


Greg Stein, http://www.lyra.org/