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: [email protected] E-mail: [email protected] Gaël Lalire <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected]
