W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2005

DOM3 Core: lookupNamespaceURI vs invalid declarations

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Mon, 19 Dec 2005 16:50:11 +0100
To: www-dom@w3.org
Message-ID: <52kdq1hobd1obn34odnova3qak4entgc93@hive.bjoern.hoehrmann.de>

Hi,

  http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407 should point
out in appendix B that lookupNamespaceURI is designed to skip all in-
valid namespace declarations during the lookup, e.g. if the tree looks
like (serialized documents cannot look like that)

  <foo xmlns:ns='http://foo.example.org/'>
    <bar xmlns:ns='http://www.w3.org/XML/1998/namespace' />
  </foo>

bar.lookupNamespaceURI('ns') would return <http://foo.example.org/> and
for

  <foo>
    <bar xmlns:ns='http://www.w3.org/XML/1998/namespace' />
  </foo>

it would return null. The main cause for this is that the for() ignores
invalid ones, but my reading is that even if the for covers both valid
and invalid ones, some errors would be ignored by the if()s inside. In
http://lists.w3.org/Archives/Public/www-archive/2005Dec/0018.html I did
not think about that and the function returns null for both cases.

The specification could also be clearer about what might qualify as a
"DOM Level 2 valid local namespace declaration attribute", my function
would also not spot some of the apparently invalid cases found in
http://lists.w3.org/Archives/Public/www-archive/2005Dec/0017.html e.g.
when .prefix is not part of .name/.nodeName.

s/else if (Attr's localname == "xmlns" and prefix == null)/if .../ would
also make sense in the pseudo code (the style would be more consistent).

regards,
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Monday, 19 December 2005 15:54:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:58 GMT