[XML-SIG] Element.localName, Attr.localName

Fred L. Drake, Jr. fdrake@acm.org
Thu, 8 Aug 2002 13:36:09 -0400


Martin v. Loewis writes:
 > > <doc xmlns:a="http://xml.python.org/a"
 > >      xmlns:A="http://xml.python.org/a"
 > >      xmlns:b="http://xml.python.org/b"
 > >      a:a="a" b:b="b"
 > >      />
 > > 
 > > This is just XML 1.0, no namespaces!
 > 
 > Why do you say that this document has no namespaces? It looks to me
 > like it has!

Because I've said this is only an XML 1.0 document only; it happens to
attributes that would be namespace declarations and prefixes if
namespace processing were active, but it isn't.

 > It may be that an application is not *aware* of the namespaces, but
 > they surely are present.

Er, no, there are no namespaces because this is only an XML 1.0
document; the namespaces recommendation does not apply.

 > That is not true. In DOM Level 2 and onwards, that should be
[...list omitted...]

If namespaces are active, yes.

 > > builder.setFeature("namespaces", 0)
 > 
 > Ah, you are turning off the feature "namespaces". I don't think the

Like I said, there are no namespaces.  ;-)

 > Load/Store spec says precisely what that means for load - it only says
 > what that means for store. One could, of course, guess that it means
 > to set all those attributes to null - in which case your
 > interpretation would be correct.

Ok, so if namespaces *are* active, what should be the localName of the
<doc/> element in my example?  Or even this document would do:

<doc/>

There is nothing there to give a namespace to the <doc/> element; what
should localName be?  Note that the createElement()
vs. createElementNS() distinction isn't helpful here, either, since
there's nothing in the LS spec that gives guidance on which to use in
this case, or even requires that either is used in any case -- that's
left as an implementation detail.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation