You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ve...@apache.org on 2003/11/14 16:41:12 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/dom AttrNSImpl.java
venu 2003/11/14 07:41:12
Modified: java/src/org/apache/xerces/dom AttrNSImpl.java
Log:
Allow to undeclare a prefix as per xml1.1 spec was error in xml1.0.
Revision Changes Path
1.39 +22 -1 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.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- AttrNSImpl.java 14 Nov 2003 11:19:37 -0000 1.38
+++ AttrNSImpl.java 14 Nov 2003 15:41:12 -0000 1.39
@@ -60,6 +60,7 @@
import org.w3c.dom.DOMException;
import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
import org.apache.xerces.xni.NamespaceContext;
+import org.apache.xerces.util.XMLSymbols;
/**
* AttrNSImpl inherits from AttrImpl and adds namespace support.
@@ -371,4 +372,24 @@
}
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: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org