public static boolean isWrappedType()

in src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java [117:217]


    public static boolean isWrappedType(Node node)
    {

        if (node == null)
            return false;

        // If the node kind is an element, dive into it.
        if (isXSDNode(node, "element"))
        {
            NodeList children = node.getChildNodes();
            boolean hasComplexType = false;
            for (int j = 0; j < children.getLength(); j++)
            {
                Node kid = children.item(j);
                if (isXSDNode(kid, "complexType"))
                {
                    node = kid;
                    hasComplexType = true;
                    break;
                }
            }
            
            if (!hasComplexType)
                return false;
        }

        // Expecting a schema complexType
        if (isXSDNode(node, "complexType"))
        {
            // Under the complexType there could be complexContent/simpleContent
            // and extension elements if this is a derived type.
            // A wrapper element must be complex-typed.

            NodeList children = node.getChildNodes();

            for (int j = 0; j < children.getLength(); j++)
            {
                Node kid = children.item(j);

                if (isXSDNode(kid, "complexContent"))
                    return false;
                else if (isXSDNode(kid, "simpleContent"))
                    return false;
            }

            // Under the complexType there may be choice, sequence, group and/or all nodes.
            // (There may be other #text nodes, which we will ignore).
            // The complex type of a wrapper element must have only sequence 
            // and again element declarations in the sequence. 
            children = node.getChildNodes();
            int len =  children.getLength();
            for (int j = 0; j < len; j++)
            {
                Node kid = children.item(j);
          		String localName = kid.getLocalName();
          		if (localName != null && Constants.isSchemaXSD(kid.getNamespaceURI())) 
                {
                  	if (localName.equals("sequence")) 
                    {
                        Node sequenceNode = kid;
                        NodeList sequenceChildren = sequenceNode.getChildNodes();
                        int sequenceLen = sequenceChildren.getLength();
                        for (int k = 0; k < sequenceLen; k++) 
                        {
                            Node sequenceKid = sequenceChildren.item(k);
                            String sequenceLocalName = sequenceKid.getLocalName();
                            if (sequenceLocalName != null &&
                                    Constants.isSchemaXSD(sequenceKid.getNamespaceURI())) 
                            {
                                // allow choice with element children
                                if (sequenceLocalName.equals("choice")) 
                                {
                                    Node choiceNode = sequenceKid;
                                    NodeList choiceChildren = choiceNode.getChildNodes();
                                    int choiceLen = choiceChildren.getLength();
                                    for (int l = 0; l < choiceLen; l++) 
                                    {
                                        Node choiceKid = choiceChildren.item(l);
                                        String choiceLocalName = choiceKid.getLocalName();
                                        if (choiceLocalName != null &&
                                                Constants.isSchemaXSD(choiceKid.getNamespaceURI())) 
                                        {
                                            if (!choiceLocalName.equals("element")) 
                                                return false;
                                        }
                                    }
                                }
                                else if (!sequenceLocalName.equals("element")) 
                                    return false;
                            }
                        }
                        return true;
                    }
                    else
                        return false;
                }
            }
        }
        // allows void type
        return true;
    }