Speaking as someone who was on the DOM Working Group at the time: Michael is entirely correct.
The DOM Level 1 non-namespace-aware nodes and methods should be considered DEPRECATED. They are simply not interoperable with DOM Level 2 code. The only justification for continuing to use them is if you must interface with ancient code which has never been updated to conform to DOM Level 2... and even then you should not expect those nodes to work properly with a DOM Level 2 application. Unfortunately the W3C did not have a formal deprecation mechansim, so the DOM WG could not express it in these terms in the Recommendation. But that really was our intent. If anyone else is really conflating these, they are not W3C DOM compliant and should fix their bug. See also http://www.w3.org/DOM/faq.html#create (Is createAttribute("href") the same as createAttributeNS(null, "href")?) for a few related words. ______________________________________ "You build world of steel and stone I build worlds of words alone Skilled tradespeople, long years taught: You shape matter; I shape thought." (http://www.songworm.com/lyrics/songworm-parody/ShapesofShadow.html) From: Michael Glavassevich <mrgla...@ca.ibm.com> To: j-users@xerces.apache.org, Date: 01/19/2012 11:58 AM Subject: Re: Attribute validation bug ? Hello Gael, This is not a bug. Please see [1] for the previous discussion. Thanks. [1] https://issues.apache.org/jira/browse/XERCESJ-1163 Michael Glavassevich XML Technologies and WAS Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Gaël Lalire <gael.lal...@bull.net> wrote on 01/18/2012 10:49:55 AM: > Hello, > > I endorsed xerces in my JVM and found a validation issue. > > When you create an attribute with DOM level 1 method > (Document.createAttribute or directly Element.setAttribute) the > created element is > a Node which Node.getLocalName() must returns null. > > In ...jaxp.validation.DOMValidatorHelper there is a method named > fillQName which fetch localName and uri from a Node for a later validation. > In most of JDK (at least sun, apple and openjdk) if the localName is > null, the method try to construct it from rawName parsing (see code below) > > However xerces seems to ignore this patch, so is it because of > ignorance or the will to refuse mix between level 1 and 2 ? > > Regards, > Gael Lalire > > -------------------------------- > > Extract from OpenJDK > > 398 private void fillQName(QName toFill, Node node) { > 399 final String prefix = node.getPrefix(); > 400 final String localName = node.getLocalName(); > > 401 final String rawName = node.getNodeName(); > 402 final String namespace = node.getNamespaceURI(); > 403 > 404 toFill.uri = (namespace != null && namespace.length > () > 0) ? fSymbolTable.addSymbol(namespace) : null; > 405 toFill.rawname = (rawName != null) ? > fSymbolTable.addSymbol(rawName) : XMLSymbols.EMPTY_STRING; > 406 > 407 // Is this a DOM level1 document? > 408 if (localName == null) { > 409 int k = rawName.indexOf(':'); > 410 if (k > 0) { > > 411 toFill.prefix = fSymbolTable.addSymbol > (rawName.substring(0, k)); > 412 toFill.localpart = fSymbolTable.addSymbol > (rawName.substring(k + 1)); > 413 } > 414 else { > 415 toFill.prefix = XMLSymbols.EMPTY_STRING; > 416 toFill.localpart = toFill.rawname; > 417 } > 418 } > 419 else { > 420 toFill.prefix = (prefix != null) ? > fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING; > > 421 toFill.localpart = (localName != null) ? > fSymbolTable.addSymbol(localName) : XMLSymbols.EMPTY_STRING; > 422 } > 423 } > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org