axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java SymbolTable.java Utils.java
Date Fri, 06 Feb 2004 00:10:57 GMT
dims        2004/02/05 16:10:57

  Modified:    java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
                        SymbolTable.java Utils.java
  Log:
  Patch for Bug 26548 - local xsd:group constructs are not processed properly
  from Hans (hplanting@mail.com)
  
  Revision  Changes    Path
  1.35      +46 -18    ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- SchemaUtils.java	26 Dec 2003 15:18:48 -0000	1.34
  +++ SchemaUtils.java	6 Feb 2004 00:10:57 -0000	1.35
  @@ -310,6 +310,26 @@
               }
   
               return v;
  +        } else if (isXSDNode(node, "group")) {
  +            NodeList children = node.getChildNodes();
  +            Vector v = new Vector();
  +            for (int j = 0; j < children.getLength(); j++) {
  +                QName subNodeKind = Utils.getNodeQName(children.item(j));
  +                if ((subNodeKind != null)
  +                        && Constants.isSchemaXSD(
  +                                subNodeKind.getNamespaceURI())) {
  +                    if (subNodeKind.getLocalPart().equals("sequence")) {
  +                        v.addAll(processSequenceNode(children.item(j),
  +                                symbolTable));
  +                    } else if (subNodeKind.getLocalPart().equals("all")) {
  +                        v.addAll(processAllNode(children.item(j), symbolTable));
  +                    } else if (subNodeKind.getLocalPart().equals("choice")) {
  +                        v.addAll(processChoiceNode(children.item(j),
  +                                symbolTable));
  +                    }
  +                }
  +            }
  +            return v;
           } else {
   
               // This may be a simpleType, return the type with the name "value"
  @@ -503,9 +523,8 @@
   
       /**
        * Invoked by getContainedElementDeclarations to get the child element types
  -     * and child element names underneath a group node.
  -     * (Currently the code only supports a defined group it does not
  -     * support a group that references a previously defined group)
  +     * and child element names underneath a group node. If a ref attribute is 
  +     * specified, only the referenced group element is returned.
        * 
        * @param groupNode   
        * @param symbolTable 
  @@ -515,26 +534,35 @@
                                              SymbolTable symbolTable) {
   
           Vector v = new Vector();
  -        NodeList children = groupNode.getChildNodes();
  -
  -        for (int j = 0; j < children.getLength(); j++) {
  -            QName subNodeKind = Utils.getNodeQName(children.item(j));
  -
  -            if ((subNodeKind != null)
  -                    && Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
  -                if (subNodeKind.getLocalPart().equals("choice")) {
  -                    v.addAll(processChoiceNode(children.item(j), symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("sequence")) {
  -                    v.addAll(processSequenceNode(children.item(j),
  -                            symbolTable));
  -                } else if (subNodeKind.getLocalPart().equals("all")) {
  -                    v.addAll(processAllNode(children.item(j), symbolTable));
  +        if (groupNode.getAttributes().getNamedItem("ref") == null) {
  +            NodeList children = groupNode.getChildNodes();
  +            for (int j = 0; j < children.getLength(); j++) {
  +                QName subNodeKind = Utils.getNodeQName(children.item(j));
  +
  +                if ((subNodeKind != null)
  +                        && Constants.isSchemaXSD(subNodeKind.getNamespaceURI()))
{
  +                    if (subNodeKind.getLocalPart().equals("choice")) {
  +                        v.addAll(processChoiceNode(children.item(j), symbolTable));
  +                    } else if (subNodeKind.getLocalPart().equals("sequence")) {
  +                        v.addAll(processSequenceNode(children.item(j),
  +                                symbolTable));
  +                    } else if (subNodeKind.getLocalPart().equals("all")) {
  +                        v.addAll(processAllNode(children.item(j), symbolTable));
  +                    }
                   }
               }
  -        }
  +        } else {
  +            BooleanHolder forElement = new BooleanHolder();
  +            QName nodeName = Utils.getTypeQName(groupNode, forElement, false);
  +            TypeEntry type = symbolTable.getTypeEntry(nodeName, forElement.value);
   
  +            if (type != null) {
  +                v.add(new ElementDecl(type, nodeName));
  +            }
  +        }
           return v;
       }
  +
   
       /**
        * Invoked by getContainedElementDeclarations to get the child element types
  
  
  
  1.88      +5 -0      ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- SymbolTable.java	10 Jan 2004 07:30:37 -0000	1.87
  +++ SymbolTable.java	6 Feb 2004 00:10:57 -0000	1.88
  @@ -995,6 +995,11 @@
   
                   // Create a type representing an attributeGroup.
                   createTypeFromDef(node, false, level > SCHEMA_LEVEL);
  +            }  else if (isXSD && localPart.equals("group")) {
  +                // Create a type entry for the referenced type
  +                createTypeFromRef(node);
  +                // Create a type representing an group
  +                createTypeFromDef(node, false, level > SCHEMA_LEVEL);
               } else if (isXSD && localPart.equals("attribute")) {
   
                   // Create a type entry for the referenced type
  
  
  
  1.35      +3 -2      ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- Utils.java	12 Dec 2003 16:58:12 -0000	1.34
  +++ Utils.java	6 Feb 2004 00:10:57 -0000	1.35
  @@ -337,7 +337,7 @@
        * An XML element or attribute node has several ways of
        * identifying the type of the element or attribute:
        * - use the type attribute to reference a complexType/simpleType
  -     * - use the ref attribute to reference another element or attributeGroup
  +     * - use the ref attribute to reference another element, group or attributeGroup
        * - use of an anonymous type (i.e. a nested type underneath itself)
        * - a wsdl:part can use the element attribute.
        * - an extension can use the base attribute.
  @@ -378,7 +378,8 @@
               // bug 23145: support attributeGroup (Brook Richan)
               // a ref can be for an element or attributeGroup
               if ((nodeKind != null)
  -                    && !nodeKind.getLocalPart().equals("attributeGroup")) {
  +                    && !(nodeKind.getLocalPart().equals("attributeGroup") ||
  +                         nodeKind.getLocalPart().equals("group"))) {
                   forElement.value = true;
               }
   
  
  
  

Mime
View raw message