Author: veithen
Date: Sun Dec  7 12:42:01 2008
New Revision: 724197

URL: http://svn.apache.org/viewvc?rev=724197&view=rev
Log:
SAXOMBuilder: Some SAX parsers report namespace declarations as attributes in 
addition to calling start/endPrefixMapping. Modified startElement to skip these 
attributes.

Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java?rev=724197&r1=724196&r2=724197&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
 Sun Dec  7 12:42:01 2008
@@ -119,11 +119,14 @@
         
         int j = atts.getLength();
         for (int i = 0; i < j; i++) {
-            OMAttribute attr = nextElem.addAttribute(atts.getLocalName(i), 
-                                                                               
         atts.getValue(i),
-                                                                               
         nextElem.findNamespace(atts.getURI(i), null));
-                                                                               
         
-            attr.setAttributeType(atts.getType(i));
+            // Note that some SAX parsers report namespace declarations as 
attributes in addition
+            // to calling start/endPrefixMapping.
+            if (!atts.getQName(i).startsWith("xmlns")) {
+                OMAttribute attr = nextElem.addAttribute(atts.getLocalName(i), 
atts.getValue(i),
+                        nextElem.findNamespace(atts.getURI(i), null));
+                                                                               
                 
+                attr.setAttributeType(atts.getType(i));
+            }
         }
         
         lastNode = nextElem;


Reply via email to