[XML-SIG] 4DOM: getAttributeNS vs getAttribute

uche.ogbuji@fourthought.com uche.ogbuji@fourthought.com
Tue, 19 Sep 2000 12:20:43 -0600

> When I create a DOM document using Sax2.FromXml, all attributes are
> created in an empty namespace using setAttributeNS. Since 4DOM maintain=
s 2
> dictionnaries (one for namespaceless attributes using the attribute nam=
> as a key, and one for the namespaced attributes using (uri,atributename=
> this means that I cannot retrieve my attributes using getAttribute, eve=
> if no namespace was specified in the XML text (am I clear?).
> =

> I somehow feel that a setAttributeNS'ed attribute should be accessible
> with getAttribute if the namespace was empty, but this is not specified=
> the DOM2 spec. What the spec says is that getAttribute retrieves attrib=
> by name, so I do not see why it should not find an attribute that has n=
> namespace. =

Hmm.  I disagree.  I think there's a fundamental difference between an =

attribute with null uri in an NS-aware system, and an attribute in a non-=
NS =

aware system.

This is easily the subject of very impassioned debate, I must admit howev=
er, =

and neither XML NS 1.0 or DOM Level 2 are much help for the philosophical=

However, from a purely practical point of view, it is much easier for 4DO=
M to =

make the two situations distinct, and since the DOM spec allows this, I =

consider it an easy decision.

Why are you constrained to use non-NS API at all?  They are all but depre=
cated =

in DOM L2 for use in NS-aware documents.

-- =

Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com =

4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python