axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@apache.org
Subject cvs commit: xml-axis/java/test/import_ Phone.xsd Import.xsd
Date Mon, 10 Dec 2001 18:39:26 GMT
butek       01/12/10 10:39:26

  Modified:    java/src/org/apache/axis/wsdl SymbolTable.java
               java/test/import_ Import.xsd
  Added:       java/test/import_ Phone.xsd
  Log:
  Fixed an import problem found by Thomas Sandholm.  Multiple levels of WSDL
  imports worked.  Multiple levels of XML imports did not.  WSDL4J only cares about
  WSDL imports, but we also care about XML imports.
  
  Revision  Changes    Path
  1.22      +28 -0     xml-axis/java/src/org/apache/axis/wsdl/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/SymbolTable.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- SymbolTable.java	2001/12/08 04:23:38	1.21
  +++ SymbolTable.java	2001/12/10 18:39:26	1.22
  @@ -89,6 +89,7 @@
   import org.apache.axis.utils.XMLUtils;
   
   import org.w3c.dom.Document;
  +import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   
  @@ -215,6 +216,14 @@
       private void populate(Definition def, Document doc) throws IOException {
           if (doc != null) {
               populateTypes(doc);
  +
  +            // If def == null, then WSDL4J doesn't provide any import logic
  +            // for this xml file.  Recurse on Document imports rather than
  +            // Definition imports.
  +            if (def == null && addImports) {
  +                // Recurse through children nodes, looking for imports
  +                lookForImports(doc);
  +            }
           }
           if (def != null) {
               if (addImports) {
  @@ -239,6 +248,25 @@
               populateServices(def);
           }
       } // populate
  +
  +    /**
  +     * Recursively find all import objects and call populate for each one.
  +     */
  +    private void lookForImports(Node node) throws IOException {
  +        NodeList children = node.getChildNodes();
  +        for (int i = 0; i < children.getLength(); i++) {
  +            Node child = children.item(i);
  +            if ("import".equals(child.getLocalName())) {
  +                NamedNodeMap attributes = child.getAttributes();
  +                Node importFile = attributes.getNamedItem("schemaLocation");
  +                if (importFile != null) {
  +                    populate(null,
  +                            XMLUtils.newDocument(importFile.getNodeValue()));
  +                }
  +            }
  +            lookForImports(child);
  +        }
  +    } // lookForImports
   
       /**
        * Populate the symbol table with all of the Types from the Document.
  
  
  
  1.3       +4 -7      xml-axis/java/test/import_/Import.xsd
  
  Index: Import.xsd
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/import_/Import.xsd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Import.xsd	2001/11/21 16:54:01	1.2
  +++ Import.xsd	2001/12/10 18:39:26	1.3
  @@ -4,13 +4,10 @@
       xmlns:tns="urn:types.import.test"
       xmlns="http://www.w3.org/2001/XMLSchema/">
   
  -    <complexType name="PhoneNumber">
  -      <all>
  -        <element name="areaCode" type="int"/>
  -        <element name="exchange" type="string"/>
  -        <element name="number" type="string"/>
  -      </all>
  -    </complexType>
  +    <import
  +      schemaLocation="test/import_/Phone.xsd"
  +      namespace="urn:types.import.test">
  +    </import>
   
       <complexType name="Address">
         <all>
  
  
  
  1.1                  xml-axis/java/test/import_/Phone.xsd
  
  Index: Phone.xsd
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
    <schema
      targetNamespace="urn:types.import.test"
      xmlns:tns="urn:types.import.test"
      xmlns="http://www.w3.org/2001/XMLSchema/">
  
      <complexType name="PhoneNumber">
        <all>
          <element name="areaCode" type="int"/>
          <element name="exchange" type="string"/>
          <element name="number" type="string"/>
        </all>
      </complexType>
  
    </schema>
  
  
  

Mime
View raw message