[XML-SIG] Default namespaces, attributes, 4DOM and the W3C recommendation
paul@boddie.net
paul@boddie.net
25 Sep 2001 17:28:43 -0000
Hello,
I have been reading up about default namespaces in XML and it seems that the
handling of default namespaces and their lack of any relationship with
attributes can prove to be somewhat tiresome to deal with. For example, if I
have a file like this...
<special xmlns="http://www.mycompany.com/special">
<something title="An example"/>
</special>
...the "title" attribute has no namespace associated with it. However, if I
then have a file like this...
<another xmlns="http://www.othercompany.com/another"
special:xmlns="http://www.mycompany.com/special">
<special:something special:title="An example"/>
</another>
...the "title" attribute has the URI of the "special" namespace associated with
it. Now I suppose I could have omitted the "special" prefix for "title", but
that would make the "ownership" of "title" application-specific, wouldn't it?
(Meaning that since no namespace is defined, it is up to the application to
find out what the attribute means.)
If we assume that "title" belongs to the "special" namespace as noted in the
second example, how can we conveniently note this in the first? Is
the "special" namespace implicitly set up (due to the nature of the name of the
element within which the default namespace is declared)?
Now, none of this is specifically relevant to 4DOM, but what I'm trying to do
is to find a convenient way of handling both of the above styles (or conformant
variants of them) in order to be able to detect permissible attributes in a
document using the getAttributeNS method on an Element, without having to find
the element's own namespace in cases where the attribute doesn't have one.
How do people deal with these cases with 4DOM? Could we have more
demonstrations in the examples directory which is distributed with it? The
traceNS.py program seems to deliberately ignore the issue - some lines in the
program address it but are commented out, at least in PyXML 0.6.5. Should
anyone be thinking of extending the DOM to make cases like those above more
easy to detect and work with? Or am I doing strange things with XML that would
shock its inventors to the very core of their collective being? ;-)
Regards,
Paul
--
Get your firstname@lastname email for FREE at http://Nameplanet.com/?su