elena 2004/01/29 12:57:40 Modified: java/src/org/apache/xerces/dom AttrNSImpl.java Log: According to the DOM Spec Attr.setValue(..) method is not supposed to raise any NamespaceErr exceptions. The Element.setAttributeNS method clearly states the cases in which namespace exception is thrown and null or empty string value for xmlns declaration is clearly not suppose to trigger any exceptions: [[ NAMESPACE_ERR: Raised if the qualifiedName is malformed per the Namespaces in XML specification, if the qualifiedName has a prefix and the namespaceURI is null, if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from "<http://www.w3.org/XML/1998/namespace>", if the qualifiedName or its prefix is "xmlns" and the namespaceURI is different from "<http://www.w3.org/2000/xmlns/>", or if the namespaceURI is "<http://www.w3.org/2000/xmlns/>" and neither the qualifiedName nor its prefix is "xmlns". ]] Revision Changes Path 1.41 +1 -20 xml-xerces/java/src/org/apache/xerces/dom/AttrNSImpl.java Index: AttrNSImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/AttrNSImpl.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- AttrNSImpl.java 18 Nov 2003 23:24:58 -0000 1.40 +++ AttrNSImpl.java 29 Jan 2004 20:57:40 -0000 1.41 @@ -371,23 +371,4 @@ return null; } - public void setValue(String newvalue) { - String qname = super.getName(); - int colon1 = qname.indexOf(':'); - if(colon1 > 0){ - String prefix = qname.substring(0, colon1); - checkNSBinding(prefix,newvalue); - } - super.setValue(newvalue); - } - - private void checkNSBinding(String prefix ,String value){ - boolean xmlVersion = ownerDocument().isXML11Version(); - if( !xmlVersion && prefix.equals(XMLSymbols.PREFIX_XMLNS) - && value.equals(XMLSymbols.EMPTY_STRING)){ - String msg = DOMMessageFormatter.formatMessage( - DOMMessageFormatter.DOM_DOMAIN,"NAMESPACE_ERR",null); - throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); - } - } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]