You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2005/11/28 07:25:03 UTC

svn commit: r349392 - /xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java

Author: mrglavas
Date: Sun Nov 27 22:24:58 2005
New Revision: 349392

URL: http://svn.apache.org/viewcvs?rev=349392&view=rev
Log:
The DTDValidator calls getQName() to get the name of an attribute but
was always receiving null because this method in XMLAttributesProxy
wasn't implemented. This caused spurious errors to be reported about
missing required attributes and attributes named "null" which aren't
declared. Implementing getQName() to fix this problem. Also implemented
getURI(), getLocalName() and getPrefix() in case they're ever needed.

Modified:
    xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java

Modified: xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java?rev=349392&r1=349391&r2=349392&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DOMNormalizer.java Sun Nov 27 22:24:58 2005
@@ -1514,66 +1514,78 @@
             return -1;
         }
 
-        public int getIndex(String uri, String localPart){
+        public int getIndex(String uri, String localPart) {
             // REVISIT: implement
             return -1;
         }
 
-        public void setName(int attrIndex, QName attrName){
+        public void setName(int attrIndex, QName attrName) {
             // REVISIT: implement
         }
 
-        public void getName(int attrIndex, QName attrName){
-            if (fAttributes !=null) {
+        public void getName(int attrIndex, QName attrName) {
+            if (fAttributes != null) {
                 updateQName((Node)fAttributes.getItem(attrIndex), attrName);
             }
         }
 
-        public String getPrefix(int index){
-            // REVISIT: implement
+        public String getPrefix(int index) {
+            if (fAttributes != null) {
+                Node node = (Node) fAttributes.getItem(index);
+                String prefix = node.getPrefix();
+                prefix = (prefix != null && prefix.length() != 0) ? fSymbolTable.addSymbol(prefix) : null;
+                return prefix;
+            }
             return null;
         }
 
-
-        public String getURI(int index){
-            // REVISIT: implement
+        public String getURI(int index) {
+            if (fAttributes != null) {
+                Node node = (Node) fAttributes.getItem(index);
+                String namespace = node.getNamespaceURI();
+                namespace = (namespace != null) ? fSymbolTable.addSymbol(namespace) : null;
+                return namespace;
+            }
             return null;
         }
 
 
-        public String getLocalName(int index){
-            // REVISIT: implement
+        public String getLocalName(int index) {
+            if (fAttributes != null) {
+                Node node = (Node) fAttributes.getItem(index);
+                String localName = node.getLocalName();
+                localName = (localName != null) ? fSymbolTable.addSymbol(localName) : null;
+                return localName;
+            }
             return null;
         }
 
-
-        public String getQName(int index){
-            // REVISIT: implement
+        public String getQName(int index) {
+            if (fAttributes != null) {
+                Node node = (Node) fAttributes.getItem(index);
+                String rawname = fSymbolTable.addSymbol(node.getNodeName());
+                return rawname;
+            }
             return null;
         }
 
-
-        public void setType(int attrIndex, String attrType){
+        public void setType(int attrIndex, String attrType) {
             // REVISIT: implement
         }
 
-
-        public String getType(int index){
+        public String getType(int index) {
             return "CDATA";
         }
 
-
-        public String getType(String qName){
+        public String getType(String qName) {
             return "CDATA";
         }
 
-
-        public String getType(String uri, String localName){
+        public String getType(String uri, String localName) {
             return "CDATA";
         }
 
-
-        public void setValue(int attrIndex, String attrValue){
+        public void setValue(int attrIndex, String attrValue) {
             // REVISIT: is this desired behaviour? 
             // The values are updated in the case datatype-normalization is turned on
             // in this case we need to make sure that specified attributes stay specified
@@ -1587,19 +1599,16 @@
             }
         }
 
-
-        public String getValue(int index){
+        public String getValue(int index) {
             return (fAttributes !=null)?fAttributes.item(index).getNodeValue():"";
 
         }
 
-
         public String getValue(String qName){
             // REVISIT: implement
             return null;
         }
 
-
         public String getValue(String uri, String localName){ 
             if (fAttributes != null) {
                 Node node =  fAttributes.getNamedItemNS(uri, localName);
@@ -1608,18 +1617,15 @@
             return null;
         }
 
-
         public void setNonNormalizedValue(int attrIndex, String attrValue){
             // REVISIT: implement
 
         }
 
-
         public String getNonNormalizedValue(int attrIndex){
             // REVISIT: implement
             return null;
         }
-
 
         public void setSpecified(int attrIndex, boolean specified){
             AttrImpl attr = (AttrImpl)fAttributes.getItem(attrIndex);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org