Index: src/xs/org/apache/ws/jaxme/xs/xml/XsNamespaceList.java
===================================================================
RCS file: /home/cvspublic/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/xml/XsNamespaceList.java,v
retrieving revision 1.3
diff -u -r1.3 XsNamespaceList.java
--- src/xs/org/apache/ws/jaxme/xs/xml/XsNamespaceList.java	15 Aug 2004 11:46:29 -0000	1.3
+++ src/xs/org/apache/ws/jaxme/xs/xml/XsNamespaceList.java	30 Aug 2004 18:40:52 -0000
@@ -81,12 +81,9 @@
      * target namespace <code>pTargetNamespace</code>.</p>
      */
     static class Other extends XsNamespaceList {
-    	private final XsAnyURI[] uris;
-    	Other(XsAnyURI pTargetNamespace) {
-    		if (pTargetNamespace == null) {
-                pTargetNamespace = new XsAnyURI("");
-            }
-    		uris = new XsAnyURI[]{pTargetNamespace};
+    	private final XsESchema schema;
+    	Other(XsESchema pSchema) {
+    		schema = pSchema;
         }
         /** @return false
          */
@@ -96,48 +93,59 @@
         public boolean isOther() { return true; }
         /** @return An array with a single element (the target namespace or "")
          */
-        public XsAnyURI[] getUris() { return uris; }
+        public XsAnyURI[] getUris() { return new XsAnyURI[]{ schema.getTargetNamespace() }; }
         /** @return The string "##other".
          */
         public String toString() { return "##other"; }
         /** <p>Returns getUris()[0].hashCode().</p>
          */
-        public int hashCode() { return uris[0].hashCode(); }
+        public int hashCode() { return schema.getTargetNamespace().hashCode(); }
         /** <p>Returns, whether this is an instance of
          * {@link Other} with the same target namespace.</p>
          */
         public boolean equals(Object pOther) {
         	return pOther != null
                 && (pOther instanceof Other)
-                && uris[0].equals(((Other) pOther).uris[0]);
+                && schema.getTargetNamespace().equals(((Other) pOther).schema.getTargetNamespace());
         }
     }
 
     static class Basic extends XsNamespaceList {
     	private final XsAnyURI[] uris;
-        private final String toStr;
-        Basic(String pValue, XsAnyURI pTargetNamespace) {
-            toStr = pValue;
-            Set set = new HashSet();
-            if (pTargetNamespace == null) {
-            	pTargetNamespace = new XsAnyURI("");
-            }
-            for (StringTokenizer st = new StringTokenizer(pValue);  st.hasMoreTokens();  ) {
+    	private final XsESchema schema;
+        private final String value;
+        Basic(String pValue, XsESchema pSchema) {
+        	value = pValue;
+        	
+        	if ("".equals(pSchema.getTargetNamespace().getURI())){
+        		schema = pSchema;
+        		uris = null;
+        	} else {
+        		uris = createUrisArray();
+        		schema = null;
+        	}
+
+        }
+        private XsAnyURI[] createUrisArray(){
+        	
+        	Set set = new HashSet();
+            for (StringTokenizer st = new StringTokenizer(value);  st.hasMoreTokens();  ) {
             	String s = st.nextToken();
                 if ("##targetNamespace".equals(s)) {
-                	set.add(pTargetNamespace);
-                } else if ("##local".equals(pTargetNamespace)) {
+                	set.add(schema.getTargetNamespace());
+                } else if ("##local".equals(s)) {
                 	set.add(new XsAnyURI(""));
                 } else {
                 	set.add(new XsAnyURI(s));
                 }
-            }
-            uris = (XsAnyURI[]) set.toArray(new XsAnyURI[set.size()]);
+            }   
+            XsAnyURI[] uris = (XsAnyURI[]) set.toArray(new XsAnyURI[set.size()]);
             Arrays.sort(uris, new Comparator(){
 				public int compare(Object pO1, Object pO2) {
 					return ((XsAnyURI) pO1).getURI().compareTo(((XsAnyURI) pO2).getURI());
                 }
-            });
+            });  
+            return uris;
         }
         /** @return false
          */
@@ -148,18 +156,24 @@
         /** @return An array with the URI's specified in the
          * 'namespace' attribute.
          */
-        public XsAnyURI[] getUris() { return uris; }
+        public XsAnyURI[] getUris() { 
+        	if (uris != null){
+        		return uris; 
+        	} else {
+        		return createUrisArray();
+        	}
+        }
         /** @return The unmodified value of the 'namespace' attribute.
          */
-        public String toString() { return toStr; }
+        public String toString() { return value; }
         /** @return An hash code suitable for applying
          * {@link Arrays#equals(Object[], Object[])} on
          * the result of {@link #getUris()}.</p>
          */
         public int hashCode() {
-            int hash = uris.length;
-            for (int i = 0;  i < uris.length;  i++) {
-                hash += uris[i].hashCode();
+            int hash = getUris().length;
+            for (int i = 0;  i < getUris().length;  i++) {
+                hash += getUris()[i].hashCode();
             }
             return hash;
         }
@@ -169,7 +183,7 @@
         public boolean equals(Object pOther) {
         	return pOther != null
                 &&  pOther instanceof Basic
-                &&  Arrays.equals(uris, ((Basic) pOther).uris);
+                &&  Arrays.equals(getUris(), ((Basic) pOther).getUris());
         }
     }
 
@@ -177,13 +191,13 @@
      * given by <code>pValue</code>. The given target namespace is used,
      * if required.</p>
      */
-    public static XsNamespaceList valueOf(String pValue, XsAnyURI pTargetNamespace) {
+    public static XsNamespaceList valueOf(String pValue, XsESchema pSchema) {
 		if ("##any".equals(pValue)) {
 			return ANY;
         } else if ("##other".equals(pValue)) {
-            return new Other(pTargetNamespace);
+            return new Other(pSchema);
         } else {
-            return new Basic(pValue, pTargetNamespace);
+            return new Basic(pValue, pSchema);
         }
 	}
 
Index: src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.java
===================================================================
RCS file: /home/cvspublic/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.java,v
retrieving revision 1.6
diff -u -r1.6 XsESchemaImpl.java
--- src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.java	27 Aug 2004 01:02:41 -0000	1.6
+++ src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.java	30 Aug 2004 18:40:54 -0000
@@ -223,7 +223,12 @@
   public void setFinalDefault(XsDerivationSet pSet) { finalDefault = pSet; }
   public XsID getId() { return id; }
   public void setId(XsID pId) { id = pId; }
-  public XsAnyURI getTargetNamespace() { return targetNamespace; }
+  public XsAnyURI getTargetNamespace() { 
+    if (targetNamespace == null) {
+    	targetNamespace = new XsAnyURI("");
+    }  
+  	return targetNamespace; 
+  }
   public String getTargetNamespacePrefix() { return targetNamespacePrefix; }
   public void setTargetNamespace(XsAnyURI pAnyURI) {
     targetNamespace = pAnyURI;
Index: src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTWildcardImpl.java
===================================================================
RCS file: /home/cvspublic/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTWildcardImpl.java,v
retrieving revision 1.3
diff -u -r1.3 XsTWildcardImpl.java
--- src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTWildcardImpl.java	15 Aug 2004 11:46:29 -0000	1.3
+++ src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTWildcardImpl.java	30 Aug 2004 18:40:57 -0000
@@ -51,7 +51,7 @@
 	}
 	
 	public void setNamespace(String pNamespaceList) {
-		namespaceList = XsNamespaceList.valueOf(pNamespaceList, getXsESchema().getTargetNamespace());
+		namespaceList = XsNamespaceList.valueOf(pNamespaceList, getXsESchema());
 	}
 	
 	public XsNamespaceList getNamespace() {
