[jdom-interest] Namespace issues, et al.
arosen at novell.com
Tue Feb 25 08:09:50 PST 2003
Coming in a little late...
"It also says, as you quote, "the interpretation of unprefixed
attributes is determined by the element on which they appear" but
interpretation != namespace name. All that phrase means is you have
to look at the element name to figure out what to do with that
attribute. It in no way means the attribute suddenly picks up a
namespace name. You're reading things into the spec that just aren't
That's true, but in his defense, that sentence seems pretty ambiguous
"I do understand that the XML/Namespace specifications are listed as
However, for all software my company writes, it is expected, since we
required to support
full Unicode, which XML 1.0 does not."
Realize, then, that you are on the very bleeding edge. XML 1.1 is not a
full Recommendation yet, only a Candidate Recommendation, and is still
"So, you are saying that the example on the W3 page CAN NOT be
validated, since the 'href' attribute wouldn't be considered
part of the xhtml dtd?"
(1) DTDs are not very compatible with namespaces. They can only be made
to (hackily) work if you force your documents to use a pre-defined
prefix for each particular namespace, which is not great (Elliotte would
say that it's wrong). This is one reason why schemas were invented.
(2) As someone mentioned, it's often up to the parent element to decide
how to interpret its attributes. The XHTML <a> element could either
specify that it has a child "href" in the null namespace or in the XHTML
namespace. Since <a> knows about its attributes, that's just a matter of
style. As long as the person who's reading the document knows which one
to look for when they see an <a> element, everything's fine. The only
time you *need* to put an attribute in a particluar namespace is when
it's a "mix-in" attribute that can be added to any kind of element, like
"xml:lang". (That example's a little weird because it's predefined by
XML but you get the point.)
More information about the jdom-interest