You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2007/11/30 03:41:26 UTC

svn commit: r599678 - in /webservices/commons/branches/modules/XmlSchema/1.3.3/src: main/java/org/apache/ws/commons/schema/XmlSchema.java test/java/tests/ImportTest.java test/java/tests/RecursiveImportTest.java

Author: ajith
Date: Thu Nov 29 18:41:25 2007
New Revision: 599678

URL: http://svn.apache.org/viewvc?rev=599678&view=rev
Log:
1. Suggested API change as per the mails at http://mail-archives.apache.org/mod_mbox/ws-commons-dev/200711.mbox/%3c60708f4b0710312204v2575637fg8390b4f093674f95@mail.gmail.com%3e

Note - This change *breaks* the use of the previous API!!!!

Modified:
    webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
    webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/ImportTest.java
    webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/RecursiveImportTest.java

Modified: webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java?rev=599678&r1=599677&r2=599678&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java Thu Nov 29 18:41:25 2007
@@ -176,23 +176,23 @@
 	}
 
 	/**
-	 * get an element by the qname
+	 * get an element by the name in the local schema
 	 * 
 	 * @param name
-	 * @param deep
 	 * @return
 	 */
-	public XmlSchemaElement getElementByName(QName name, boolean deep) {
-		return this.getElementByName(name, deep, null);
+	public XmlSchemaElement getElementByName(String name) {
+        QName nameToSearchFor = new QName(this.getTargetNamespace(),name);
+        return this.getElementByName(nameToSearchFor, false, null);
 	}
 
 	/**
-	 * @deprecated use the {@link #getElementByName(QName, boolean)} method
+	 * Look for a element by its qname. Searches through all the schemas
 	 * @param name
 	 * @return
 	 */
 	public XmlSchemaElement getElementByName(QName name) {
-		return this.getElementByName(name, false, null);
+		return this.getElementByName(name, true, null);
 	}
 
 	/**
@@ -243,22 +243,23 @@
 	}
 
 	/**
-	 * @deprecated use the {@link #getTypeByName(QName, boolean)}
+	 * Search this schema and all the imported/included ones
+     * for the given Qname
 	 * @param name
 	 * @return
 	 */
 	public XmlSchemaType getTypeByName(QName name) {
-		return getTypeByName(name, false, null);
+		return getTypeByName(name, true, null);
 	}
 
 	/**
 	 * 
 	 * @param name
-	 * @param deep
 	 * @return
 	 */
-	public XmlSchemaType getTypeByName(QName name, boolean deep) {
-		return getTypeByName(name, deep, null);
+	public XmlSchemaType getTypeByName(String name) {
+        QName nameToSearchFor = new QName(this.getTargetNamespace(),name);
+        return getTypeByName(nameToSearchFor, false, null);
 	}
 
 	/**

Modified: webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/ImportTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/ImportTest.java?rev=599678&r1=599677&r2=599678&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/ImportTest.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/ImportTest.java Thu Nov 29 18:41:25 2007
@@ -83,7 +83,7 @@
         XmlSchema schema = schemaCol.read(doc,file.toURL().toString(),null);
         assertNotNull(schema);
 
-        assertNotNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct"),true));
-        assertNotNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper"),true));
+        assertNotNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
+        assertNotNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
     }
 }

Modified: webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/RecursiveImportTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/RecursiveImportTest.java?rev=599678&r1=599677&r2=599678&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/RecursiveImportTest.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1.3.3/src/test/java/tests/RecursiveImportTest.java Thu Nov 29 18:41:25 2007
@@ -45,8 +45,9 @@
       
         
         //these qnames are *not* there in these schemas
-        assertNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct"),true));
-        assertNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper"),true));
+        assertNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
+        assertNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
+
     }
 
     



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org