Re: namespaces and DTD interactions

Attributes in XML files do not inherit namespaces, nor do they pick up the
default namespace; if you want an Attr to be namespaced, you must use an
explicit prefix and define that prefix. See the Namespaces specification.

It is possible to use the DOM APIs to explicitly create an Attr which has a
Namespace but does not have a prefix. It is the serializer's reponsibility
to repair this situation when you write that document out as XML syntax.
Typically it will either find and use an existing prefix for that URI, or
synthesize and declare a new one, or ask the user for guidance. Since the
DOM does not yet define serializer behavior, nor provide a check for
namespace-well-formedness, nor provide namespace-to-prefix or
prefix-to-namespace lookup operations, we have not yet expressed any
opinion regarding which of these options is preferred. DOM Level 3 will add
some of those functions, and may or may not recommend specific solutions.

______________________________________
Joe Kesselman  / IBM Research

Received on Tuesday, 20 March 2001 16:18:42 UTC