Java Code Examples for org.apache.ws.commons.schema.XmlSchemaComplexType#getQName()

The following examples show how to use org.apache.ws.commons.schema.XmlSchemaComplexType#getQName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 6 votes vote down vote up
private CorbaType processComplexType(XmlSchemaComplexType complex, QName defaultName,
                                         XmlSchemaAnnotation annotation,
                                         boolean anonymous) throws Exception {
    CorbaType corbatype = null;
    if (isLiteralArray(complex)) {
        corbatype = processLiteralArray(complex, defaultName, anonymous);
    } else if (WSDLTypes.isOMGUnion(complex)) {
        corbatype = processOMGUnion(complex, defaultName);
    } else if (WSDLTypes.isUnion(complex)) {
        corbatype = processRegularUnion(complex, defaultName);
    } else if (complex.getQName() != null && isIDLObjectType(complex.getQName())) {
        // process it.
        corbatype = WSDLTypes.processObject(def, complex, annotation, checkPrefix(complex.getQName()),
                                            defaultName, idlNamespace);
    } else {
        // Deal the ComplexType as Struct
        corbatype = processStruct(complex, defaultName);
    }
    return corbatype;
}
 
Example 2
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 5 votes vote down vote up
private CorbaType processRegularUnion(XmlSchemaComplexType complex,
                                          QName defaultName) throws Exception {
    //NEED TO DO
    QName name = null;
    QName schematypeName = complex.getQName();

    if (schematypeName == null) {
        schematypeName = defaultName;
        name = createQNameCorbaNamespace(defaultName.getLocalPart() + "Type");
    } else {
        name = createQNameCorbaNamespace(schematypeName.getLocalPart());
    }

    return createUnion(name, (XmlSchemaChoice)complex.getParticle(), defaultName, schematypeName);
}
 
Example 3
Source File: SchemaJavascriptBuilder.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void deserializeElement(XmlSchemaComplexType type, ParticleInfo itemInfo) {
    if (itemInfo.isGroup()) {
        for (ParticleInfo childElement : itemInfo.getChildren()) {
            deserializeElement(type, childElement);
        }
        return;
    }

    XmlSchemaType itemType = itemInfo.getType();
    boolean simple = itemType instanceof XmlSchemaSimpleType
                     || JavascriptUtils.notVeryComplexType(itemType);
    boolean mtomCandidate = JavascriptUtils.mtomCandidateType(itemType);
    String accessorName = "set" + StringUtils.capitalize(itemInfo.getJavascriptName());
    utils.appendLine("cxfjsutils.trace('processing " + itemInfo.getJavascriptName() + "');");
    XmlSchemaElement element = (XmlSchemaElement)itemInfo.getParticle();
    QName elementQName = XmlSchemaUtils.getElementQualifiedName(element, xmlSchema);
    String elementNamespaceURI = elementQName.getNamespaceURI();
    boolean elementNoNamespace = "".equals(elementNamespaceURI);
    XmlSchema elementSchema = null;
    if (!elementNoNamespace) {
        elementSchema = xmlSchemaCollection.getSchemaByTargetNamespace(elementNamespaceURI);
    }
    boolean qualified = !elementNoNamespace
                        && XmlSchemaUtils.isElementQualified(element, itemInfo.isGlobal(), xmlSchema,
                                                             elementSchema);

    if (!qualified) {
        elementNamespaceURI = "";
    }

    String localName = elementQName.getLocalPart();
    String valueTarget = "item";

    if (itemInfo.isOptional() || itemInfo.isArray()) {
        utils.startIf("curElement != null && cxfjsutils.isNodeNamedNS(curElement, '"
                      + elementNamespaceURI + "', '" + localName + "')");
        if (itemInfo.isArray()) {
            utils.appendLine("item = [];");
            utils.startDo();
            valueTarget = "arrayItem";
            utils.appendLine("var arrayItem = null;");
        }
    }

    utils.appendLine("var value = null;");
    utils.startIf("!cxfjsutils.isElementNil(curElement)");
    if (itemInfo.isAnyType()) {
        // use our utility
        utils.appendLine(valueTarget + " = org_apache_cxf_deserialize_anyType(cxfjsutils, curElement);");
    } else if (simple) {
        if (mtomCandidate) {
            utils.appendLine(valueTarget + " = cxfjsutils.deserializeBase64orMom(curElement);");
        } else {
            utils.appendLine("value = cxfjsutils.getNodeText(curElement);");
            utils.appendLine(valueTarget + " = " + utils.javascriptParseExpression(itemType, "value")
                             + ";");
        }
    } else {
        XmlSchemaComplexType complexType = (XmlSchemaComplexType)itemType;
        QName baseQName = complexType.getQName();
        if (baseQName == null) {
            baseQName = element.getQName();
        }

        String elTypeJsName = nameManager.getJavascriptName(baseQName);
        utils.appendLine(valueTarget + " = " + elTypeJsName + "_deserialize(cxfjsutils, curElement);");
    }

    utils.endBlock(); // the if for the nil.
    if (itemInfo.isArray()) {
        utils.appendLine("item.push(arrayItem);");
        utils.appendLine("curElement = cxfjsutils.getNextElementSibling(curElement);");
        utils.endBlock();
        utils.appendLine("  while(curElement != null && cxfjsutils.isNodeNamedNS(curElement, '"
                         + elementNamespaceURI + "', '" + localName + "'));");
    }
    utils.appendLine("newobject." + accessorName + "(item);");
    utils.appendLine("var item = null;");
    if (!itemInfo.isArray()) {
        utils.startIf("curElement != null");
        utils.appendLine("curElement = cxfjsutils.getNextElementSibling(curElement);");
        utils.endBlock();
    }
    if (itemInfo.isOptional() || itemInfo.isArray()) {
        utils.endBlock();
    }
}
 
Example 4
Source File: BasicNameManager.java    From cxf with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc}*/
public String getJavascriptName(XmlSchemaComplexType schemaType) {
    QName typeQName = schemaType.getQName();
    return getJavascriptName(typeQName);
}