axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r814572 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Date Mon, 14 Sep 2009 10:48:33 GMT
Author: amilas
Date: Mon Sep 14 10:48:33 2009
New Revision: 814572

URL: http://svn.apache.org/viewvc?rev=814572&view=rev
Log:
fixed the issue AXIS2-4071. check the existence of an element before adding it to the schema.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=814572&r1=814571&r2=814572&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Mon Sep 14 10:48:33 2009
@@ -1753,6 +1753,25 @@
 
         Document ownerDocument = schemaElement.getOwnerDocument();
 
+        String newElementName = newElement.getAttribute(XSD_NAME);
+
+        // check whether this element already exists.
+        NodeList nodeList = schemaElement.getChildNodes();
+        Element nodeElement = null;
+        for (int i = 1; i < nodeList.getLength(); i++) {
+            if (nodeList.item(i) instanceof Element){
+                nodeElement = (Element) nodeList.item(i);
+                if (nodeElement.getLocalName().equals(XML_SCHEMA_ELEMENT_LOCAL_NAME)){
+                    if (nodeElement.getAttribute(XSD_NAME).equals(newElementName)){
+                        // if the element already exists we do not add this element
+                        // and just return.
+                        return;
+                    }
+                }
+            }
+
+        }
+
         // loop through the namespace declarations first and add them
         String[] nameSpaceDeclarationArray = (String[]) namespacePrefixMap
                 .keySet().toArray(new String[namespacePrefixMap.size()]);



Mime
View raw message