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

Reply via email to