ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r230792 - in /webservices/commons/trunk/XmlSchema: build.xml src/org/apache/axis/xsd/xml/schema/SchemaBuilder.java src/org/apache/axis/xsd/xml/schema/XmlSchema.java src/org/apache/axis/xsd/xml/schema/XmlSchemaCollection.java
Date Mon, 08 Aug 2005 12:40:27 GMT
Author: gdaniels
Date: Mon Aug  8 05:40:23 2005
New Revision: 230792

URL: http://svn.apache.org/viewcvs?rev=230792&view=rev
Log:
Give individual schemas access to their parent collections, and default to building the jar.

Modified:
    webservices/commons/trunk/XmlSchema/build.xml
    webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/SchemaBuilder.java
    webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchema.java
    webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaCollection.java

Modified: webservices/commons/trunk/XmlSchema/build.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/build.xml?rev=230792&r1=230791&r2=230792&view=diff
==============================================================================
--- webservices/commons/trunk/XmlSchema/build.xml (original)
+++ webservices/commons/trunk/XmlSchema/build.xml Mon Aug  8 05:40:23 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<project name="XmlSchema" basedir="." default="compile">
+<project name="XmlSchema" basedir="." default="jar">
 
 	<property name="src.dir" value="${basedir}/src"/>
 	<property name="project.name" value="XmlSchema"/>

Modified: webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/SchemaBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/SchemaBuilder.java?rev=230792&r1=230791&r2=230792&view=diff
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/SchemaBuilder.java
(original)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/SchemaBuilder.java
Mon Aug  8 05:40:23 2005
@@ -29,7 +29,7 @@
 
     SchemaBuilder(XmlSchemaCollection collection) {
         this.collection = collection;
-        schema = new XmlSchema();
+        schema = new XmlSchema(collection);
     }
 
     XmlSchema build(Document doc, ValidationEventHandler veh) {
@@ -1392,7 +1392,7 @@
             String namespace = "";
 
             if (args.length > 1) {
-                Object result = schema.namespaces.get(args[0]);
+                Object result = schema.getNamespace(args[0]);
                 if (result == null)
                     throw new XmlSchemaException(
                             "Couldn't map prefix '" + args[0] +
@@ -1410,6 +1410,7 @@
                 // Could be a forward reference...
                 collection.addUnresolvedType(typeQName, element);
             }
+            element.schemaType = type;
         } else if (el.getAttributeNode("ref") != null) {
             String refName = el.getAttribute("ref");
 
@@ -1798,7 +1799,7 @@
 
     XmlSchema getXmlSchemaFromLocation(String schemaLocation) {
         try {
-            XmlSchema s = new XmlSchema();
+            XmlSchema s = new XmlSchema(collection);
             java.net.URL u = new java.net.URL(schemaLocation);
             java.io.InputStream uStream = u.openConnection().getInputStream();
             java.io.InputStreamReader readerS =

Modified: webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchema.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchema.java?rev=230792&r1=230791&r2=230792&view=diff
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchema.java
(original)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchema.java
Mon Aug  8 05:40:23 2005
@@ -110,11 +110,13 @@
     String targetNamespace = "DEFAULT", version;
     Hashtable namespaces;
     String schema_ns_prefix = "";
+    XmlSchemaCollection parent;
 
     /**
      * Creates new XmlSchema
      */
-    public XmlSchema() {
+    public XmlSchema(XmlSchemaCollection parent) {
+        this.parent = parent;
         attributeFormDefault = new XmlSchemaForm("Qualified");
         elementFormDefault = new XmlSchemaForm("Qualified");
         blockDefault = new XmlSchemaDerivationMethod("None");
@@ -130,13 +132,17 @@
         schemaTypes = new XmlSchemaObjectTable();
     }
 
-    public XmlSchema(String namespace) {
-        this();
+    public XmlSchema(String namespace, XmlSchemaCollection parent) {
+        this(parent);
         targetNamespace = namespace;
     }
 
     protected String getNamespace(String prefix) {
-        return "" + namespaces.get(prefix);
+        String ns = (String)namespaces.get(prefix);
+        if (ns == null) {
+            return parent.getNamespaceForPrefix(prefix);
+        }
+        return ns;
     }
 
     public XmlSchemaForm getAttributeFormDefault() {

Modified: webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaCollection.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaCollection.java?rev=230792&r1=230791&r2=230792&view=diff
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaCollection.java
(original)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaCollection.java
Mon Aug  8 05:40:23 2005
@@ -94,7 +94,12 @@
      */
     Map namespaces = new HashMap();
 
-    XmlSchema xsd = new XmlSchema(XmlSchema.SCHEMA_NS);
+    /**
+     * In-scope namespaces for XML processing
+     */
+    Map inScopeNamespaces = new HashMap();
+
+    XmlSchema xsd = new XmlSchema(XmlSchema.SCHEMA_NS, this);
 
     public void init() {
         XmlSchemaSimpleType type;
@@ -215,5 +220,13 @@
             receiver.setType(type);
         }
         unresolvedTypes.remove(typeName);
+    }
+
+    public String getNamespaceForPrefix(String prefix) {
+        return (String)inScopeNamespaces.get(prefix);
+    }
+
+    public void mapNamespace(String prefix, String namespaceURI) {
+        inScopeNamespaces.put(prefix, namespaceURI);
     }
 }



Mime
View raw message