You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2005/08/25 09:18:55 UTC
svn commit: r240010 -
/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java
Author: ajith
Date: Thu Aug 25 00:18:41 2005
New Revision: 240010
URL: http://svn.apache.org/viewcvs?rev=240010&view=rev
Log:
updated to validator to check the target namespace only when it's not containing a single import statement
Modified:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java?rev=240010&r1=240009&r2=240010&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtension.java Thu Aug 25 00:18:41 2005
@@ -23,6 +23,8 @@
import org.apache.wsdl.extensions.ExtensionConstants;
import org.apache.wsdl.extensions.Schema;
import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
import java.util.Iterator;
@@ -49,7 +51,19 @@
boolean targetnamespaceFound = false;
if (ExtensionConstants.SCHEMA.equals(element.getType())) {
Schema schema = (Schema) element;
- NamedNodeMap attributes = schema.getElement().getAttributes();
+ Element schemaElement = schema.getElement();
+ //first check whether the schema include only a single import statement.
+ //As per the nature of WSDL if the schema has a single import ONLY, then the
+ //schema element need not contain a target namespace.
+ NodeList importNodeList = schemaElement.getElementsByTagNameNS(schemaElement.getNamespaceURI(),"import");
+ NodeList allNodes = schemaElement.getElementsByTagName("*");
+ //checking the number of child elements and the number of import elements should get us what we need
+ if (importNodeList.getLength()==1 && allNodes.getLength()==1){
+ return;
+ }
+
+
+ NamedNodeMap attributes = schemaElement.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
if (TARGETNAMESPACE_STRING.equalsIgnoreCase(
attributes.item(i).getLocalName())){