Package javax.wsdl

Examples of javax.wsdl.QName


        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node complexNode = null;
            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                QName complexKind = Utils.getNodeQName(children.item(j));
                if (complexKind != null &&
                    complexKind.getLocalPart().equals("complexType") &&
                    Utils.isSchemaNS(complexKind.getNamespaceURI())) {
                    complexNode = children.item(j);
                    node = complexNode;
                }
            }
        }
        // Get the node kind, expecting a schema complexType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("complexType") &&
            Utils.isSchemaNS(nodeKind.getNamespaceURI())) {

            // Inder the complexType there could be a group node.
            // (There may be other #text nodes, which we will ignore).
            NodeList children = node.getChildNodes();
            Node groupNode = null;
            for (int j = 0;
                 j < children.getLength() && groupNode == null;
                 j++) {
                QName kind = Utils.getNodeQName(children.item(j));
                if (kind != null &&
                           (kind.getLocalPart().equals("sequence") ||
                            kind.getLocalPart().equals("all")) &&
                           Utils.isSchemaNS(kind.getNamespaceURI())) {
                    groupNode = children.item(j);
                }
            }

            // If a group node, a single element should be underneath
            if (groupNode != null) {
                children = groupNode.getChildNodes();
            }

            // Now get the element node.  There can only be one element node.     
            Node elementNode = null;
            int elementNodeCount = 0;
            for (int i=0; i < children.getLength(); i++) {
                QName elementKind = Utils.getNodeQName(children.item(i));
                if (elementKind != null &&
                    elementKind.getLocalPart().equals("element") &&
                    Utils.isSchemaNS(elementKind.getNamespaceURI())) {
                    elementNode = children.item(i);
                    elementNodeCount++;
                }
            }
View Full Code Here


        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node complexNode = null;
            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                QName complexKind = Utils.getNodeQName(children.item(j));
                if (complexKind != null &&
                    complexKind.getLocalPart().equals("complexType") &&
                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
                    complexNode = children.item(j);
                    node = complexNode;
                }
            }
        }

        // Expecting a schema complexType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("complexType") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {

            // Under the complexType there could be complexContent/simpleContent
            // and extension elements if this is a derived type.  Skip over these.
            NodeList children = node.getChildNodes();
            Node complexContent = null;
            Node simpleContent = null;
            Node extension = null;
            for (int j = 0; j < children.getLength() && complexContent == null; j++) {
                QName complexContentKind = Utils.getNodeQName(children.item(j));
                if (complexContentKind != null &&
                    Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
                    if (complexContentKind.getLocalPart().equals("complexContent") )
                        complexContent = children.item(j);
                    else if (complexContentKind.getLocalPart().equals("simpleContent"))
                        simpleContent = children.item(j);
                }
            }
            if (complexContent != null) {
                children = complexContent.getChildNodes();
                for (int j = 0; j < children.getLength() && extension == null; j++) {
                    QName extensionKind = Utils.getNodeQName(children.item(j));
                    if (extensionKind != null &&
                        extensionKind.getLocalPart().equals("extension") &&
                        Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
                        extension = children.item(j);
                }
            }
            if (simpleContent != null) {
                children = simpleContent.getChildNodes();
                for (int j = 0; j < children.getLength() && extension == null; j++) {
                    QName extensionKind = Utils.getNodeQName(children.item(j));
                    if (extensionKind != null &&
                        extensionKind.getLocalPart().equals("extension") &&
                        Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
                       
                        // get the type of the extension
                        QName extendsType =
                                Utils.getNodeTypeRefQName(children.item(j),
                                                          "base");
                       
                        // Return an element declaration with a fixed name
                        // ("value") and the correct type.
                       
                        Vector v = new Vector();
                        ElementDecl elem = new ElementDecl();
                        elem.setType(symbolTable.getTypeEntry(extendsType, false));
                        elem.setName(new javax.xml.rpc.namespace.QName("", "value"));
                        v.add(elem);
                        return v;
                    }
                       
                }
            }

            if (extension != null) {
                node = extension;  // Skip over complexContent and extension
            }

            // Under the complexType (or extension) there should be a sequence or all group node.
            // (There may be other #text nodes, which we will ignore).
            children = node.getChildNodes();
            Node groupNode = null;
            for (int j = 0; j < children.getLength() && groupNode == null; j++) {
                QName groupKind = Utils.getNodeQName(children.item(j));
                if (groupKind != null &&
                    (groupKind.getLocalPart().equals("sequence") ||
                     groupKind.getLocalPart().equals("all")) &&
                    Constants.isSchemaXSD(groupKind.getNamespaceURI()))
                    groupNode = children.item(j);
            }

            if (groupNode == null) {
                // didn't find anything
                return new Vector();
            }

            if (groupNode != null) {
                // Process each of the choice or element nodes under the sequence/all node
                Vector v = new Vector();
                NodeList elements = groupNode.getChildNodes();
                for (int i=0; i < elements.getLength(); i++) {
                    QName elementKind = Utils.getNodeQName(elements.item(i));
                    if (elementKind != null &&
                        Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
                        if ( elementKind.getLocalPart().equals("element")) {
                            ElementDecl elem =
                                    processChildElementNode(elements.item(i),
                                                            symbolTable);
                            if (elem != null)
                                v.add(elem);
                        } else if (elementKind.getLocalPart().equals("choice")) {
                            Vector choiceElems = processChoiceNode(elements.item(i), symbolTable);
                            v.addAll(choiceElems);
                        }
                    }
                }
View Full Code Here

    private static Vector processChoiceNode(Node choiceNode,
                                            SymbolTable symbolTable) {
        Vector v = new Vector();
        NodeList children = choiceNode.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("group")) {
                    v.addAll(processGroupNode(children.item(j), symbolTable));
                } else if (subNodeKind.getLocalPart().equals("element")) {
                    ElementDecl elem =
                            processChildElementNode(children.item(j),
                                                    symbolTable);
                    if (elem != null)
                        v.add(elem);
View Full Code Here

    private static Vector processSequenceNode(Node sequenceNode,
                                              SymbolTable symbolTable) {
        Vector v = new Vector();
        NodeList children = sequenceNode.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("group")) {
                    v.addAll(processGroupNode(children.item(j), symbolTable));
                } else if (subNodeKind.getLocalPart().equals("element")) {
                    ElementDecl elem =
                            processChildElementNode(children.item(j),
                                                    symbolTable);
                    if (elem != null)
                        v.add(elem);
View Full Code Here

     */
    private static Vector processAllNode(Node allNode, SymbolTable symbolTable) {
        Vector v = new Vector();
        NodeList children = allNode.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("element")) {
                    ElementDecl elem =
                            processChildElementNode(children.item(j),
                                                    symbolTable);
                    if (elem != null)
                        v.add(elem);
View Full Code Here

    private static ElementDecl processChildElementNode(Node elementNode,
                                                  SymbolTable symbolTable) {
        // Get the name and type qnames.
        // The type qname is used to locate the TypeEntry, which is then
        // used to retrieve the proper java name of the type.
        QName nodeName = Utils.getNodeNameQName(elementNode);
        BooleanHolder forElement = new BooleanHolder();
        QName nodeType = Utils.getNodeTypeRefQName(elementNode, forElement);
        if (nodeType == null) { // The element may use an anonymous type      
            nodeType = getElementAnonQName(elementNode);           
            forElement.value = false;
        }
       
View Full Code Here

    /**
     * Returns the WSDL2Java QName for the anonymous type of the element
     * or null.
     */
    public static QName getElementAnonQName(Node node) {
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            for (int j = 0; j < children.getLength(); j++) {
                QName kind = Utils.getNodeQName(children.item(j));
                if (kind != null &&
                    (kind.getLocalPart().equals("complexType") ||
                     kind.getLocalPart().equals("simpleType")) &&
                    Constants.isSchemaXSD(kind.getNamespaceURI())) {
                    return Utils.getNodeNameQName(children.item(j));
                }
            }
        }
        return null;
View Full Code Here

        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node complexNode = null;
            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                QName complexKind = Utils.getNodeQName(children.item(j));
                if (complexKind != null &&
                    complexKind.getLocalPart().equals("complexType") &&
                    Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
                    complexNode = children.item(j);
                    node = complexNode;
                }
            }
        }

        // Expecting a schema complexType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("complexType") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {

            // Under the complexType there could be should be a complexContent &
            // extension elements if this is a derived type.
            NodeList children = node.getChildNodes();
            Node content = null;
            Node extension = null;
            for (int j = 0; j < children.getLength() && content == null; j++) {
                QName contentKind = Utils.getNodeQName(children.item(j));
                if (contentKind != null &&
                    contentKind.getLocalPart().equals("complexContent") &&
                    Constants.isSchemaXSD(contentKind.getNamespaceURI()))
                    content = children.item(j);
                if (contentKind != null &&
                    contentKind.getLocalPart().equals("simpleContent") &&
                    Constants.isSchemaXSD(contentKind.getNamespaceURI()))
                    content = children.item(j);
            }
            if (content != null) {
                children = content.getChildNodes();
                for (int j = 0; j < children.getLength() && extension == null; j++) {
                    QName extensionKind = Utils.getNodeQName(children.item(j));
                    if (extensionKind != null &&
                        extensionKind.getLocalPart().equals("extension") &&
                        Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
                        extension = children.item(j);
                }
            }
            if (extension == null) {
                return null// No extension                              
            }

            // Get the QName of the extension base
            QName extendsType = Utils.getNodeTypeRefQName(extension, "base");
            if (extendsType == null) {
                return null; // No extension base
            }
            // Return associated Type
            return (TypeEntry) symbolTable.getType(extendsType);
View Full Code Here

        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node simpleNode = null;
            for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
                QName simpleKind = Utils.getNodeQName(children.item(j));
                if (simpleKind != null &&
                    simpleKind.getLocalPart().equals("simpleType") &&
                    Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
                    simpleNode = children.item(j);
                    node = simpleNode;
                }
            }
        }
        // Get the node kind, expecting a schema simpleType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("simpleType") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {

            // Under the simpleType there should be a restriction.
            // (There may be other #text nodes, which we will ignore).
            NodeList children = node.getChildNodes();
            Node restrictionNode = null;
            for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
                QName restrictionKind = Utils.getNodeQName(children.item(j));
                if (restrictionKind != null &&
                    restrictionKind.getLocalPart().equals("restriction") &&
                    Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
                    restrictionNode = children.item(j);
            }

            // The restriction node indicates the type being restricted
            // (the base attribute contains this type).
            // The base type must be a built-in type, and not boolean
            TypeEntry baseEType = null;
            if (restrictionNode != null) {
                QName baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
                baseEType = symbolTable.getType(baseType);
                if (baseEType != null) {
                    String javaName = baseEType.getName();
                    if (javaName.equals("java.lang.String") ||
                        javaName.equals("int") ||
                        javaName.equals("long") ||
                        javaName.equals("short") ||
                        javaName.equals("float") ||
                        javaName.equals("double") ||
                        javaName.equals("byte"))
                        ; // Okay Type
                    else
                        baseEType = null;
                }
            }

            // Process the enumeration elements underneath the restriction node
            if (baseEType != null && restrictionNode != null) {

                Vector v = new Vector();               
                NodeList enums = restrictionNode.getChildNodes();
                for (int i=0; i < enums.getLength(); i++) {
                    QName enumKind = Utils.getNodeQName(enums.item(i));
                    if (enumKind != null &&
                        enumKind.getLocalPart().equals("enumeration") &&
                        Constants.isSchemaXSD(enumKind.getNamespaceURI())) {

                        // Put the enum value in the vector.
                        Node enumNode = enums.item(i);
                        String value = Utils.getAttribute(enumNode, "value");
                        if (value != null) {
View Full Code Here

    /**
     * If the specified node represents a 'normal' non-enumeration simpleType,
     * the QName of the simpleType base is returned.
     */
    public static QName getSimpleTypeBase(Node node, SymbolTable symbolTable) {
        QName baseQName = null;

        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node simpleNode = null;
            for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
                QName simpleKind = Utils.getNodeQName(children.item(j));
                if (simpleKind != null &&
                    simpleKind.getLocalPart().equals("simpleType") &&
                    Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
                    simpleNode = children.item(j);
                    node = simpleNode;
                }
            }
        }
        // Get the node kind, expecting a schema simpleType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("simpleType") &&
            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {

            // Under the simpleType there should be a restriction.
            // (There may be other #text nodes, which we will ignore).
            NodeList children = node.getChildNodes();
            Node restrictionNode = null;
            for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
                QName restrictionKind = Utils.getNodeQName(children.item(j));
                if (restrictionKind != null &&
                    restrictionKind.getLocalPart().equals("restriction") &&
                    Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
                    restrictionNode = children.item(j);
            }

            // The restriction node indicates the type being restricted
            // (the base attribute contains this type).
           
            if (restrictionNode != null) {
                baseQName = Utils.getNodeTypeRefQName(restrictionNode, "base");
            }
           
            // Look for enumeration elements underneath the restriction node
            if (baseQName != null && restrictionNode != null) {
                NodeList enums = restrictionNode.getChildNodes();
                for (int i=0; i < enums.getLength(); i++) {
                    QName enumKind = Utils.getNodeQName(enums.item(i));
                    if (enumKind != null &&
                        enumKind.getLocalPart().equals("enumeration") &&
                        Constants.isSchemaXSD(enumKind.getNamespaceURI())) {
                       
                        // Found an enumeration, this isn't a
                        // 'normal' simple type.
                        return null;
                    }
View Full Code Here

TOP

Related Classes of javax.wsdl.QName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.