org.apache.ws.commons.schema.XmlSchemaAll Java Examples

The following examples show how to use org.apache.ws.commons.schema.XmlSchemaAll. 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: XmlSchemaExtractor.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
private void handleGroupParticle(XmlSchemaGroupParticle target, XmlSchemaGroupParticle source) throws ParserException {
    final List sourceItems;
    final List targetItems;

    // unfortunately the group 'all, choice and sequence' classes don't implement a common interface
    // hence the kludgy code below
    if (source instanceof XmlSchemaAll) {
        sourceItems = ((XmlSchemaAll) source).getItems();
        targetItems = ((XmlSchemaAll) target).getItems();
    } else if (source instanceof XmlSchemaChoice) {
        sourceItems = ((XmlSchemaChoice)source).getItems();
        targetItems = ((XmlSchemaChoice)target).getItems();
    } else if (source instanceof XmlSchemaSequence) {
        sourceItems = ((XmlSchemaSequence)source).getItems();
        targetItems = ((XmlSchemaSequence)target).getItems();
    } else {
        throw new ParserException("Unsupported Group Particle type " + source.getClass().getName());
    }

    // add all source items to target schemas
    for (Object item : sourceItems) {
        targetItems.add(createXmlSchemaObjectBase((XmlSchemaObjectBase) item));
    }
}
 
Example #2
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected CorbaType processAllType(XmlSchemaAll seq, QName defaultName,
                                       QName schematypeName) throws Exception {
    QName allName = null;
    Struct type = null;

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

    type = new Struct();
    type.setName(allName.getLocalPart());
    type.setQName(allName);
    type.setType(schematypeName);

    List<MemberType> members = processContainerAsMembers(seq, defaultName, schematypeName);
    for (MemberType memberType : members) {
        type.getMember().add(memberType);
    }

    String repoId = REPO_STRING + type.getQName().getLocalPart().replace('.', '/') + IDL_VERSION;
    type.setRepositoryID(repoId);
    return type;
}
 
Example #3
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 6 votes vote down vote up
private Struct processComplexContentStructSchemaAll(Struct corbaStruct, XmlSchemaAll all,
                                              QName defaultName, QName schematypeName)
    throws Exception {

    CorbaType alltype = processAllType(all, defaultName, schematypeName);
    MemberType allmem = new MemberType();
    allmem.setName(alltype.getQName().getLocalPart() + "_f");
    allmem.setIdltype(alltype.getQName());
    allmem.setAnonschematype(true);
    if (alltype.isSetQualified() && alltype.isQualified()) {
        allmem.setQualified(true);
    }
    corbaStruct.getMember().add(allmem);
    if (!isDuplicate(alltype)) {
        typeMappingType.getStructOrExceptionOrUnion().add(alltype);
    }

    return corbaStruct;
}
 
Example #4
Source File: SchemaCollection.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void addCrossImportsType(XmlSchema schema, XmlSchemaType schemaType) {
    // the base type might cross schemas.
    if (schemaType instanceof XmlSchemaComplexType) {
        XmlSchemaComplexType complexType = (XmlSchemaComplexType)schemaType;
        XmlSchemaUtils.addImportIfNeeded(schema, complexType.getBaseSchemaTypeName());
        addCrossImports(schema, complexType.getContentModel());
        addCrossImportsAttributeList(schema, complexType.getAttributes());
        // could it be a choice or something else?

        if (complexType.getParticle() instanceof XmlSchemaChoice) {
            XmlSchemaChoice choice = (XmlSchemaChoice)complexType.getParticle();
            addCrossImports(schema, choice);
        } else if (complexType.getParticle() instanceof XmlSchemaAll) {
            XmlSchemaAll all = (XmlSchemaAll)complexType.getParticle();
            addCrossImports(schema, all);
        } else if (complexType.getParticle() instanceof XmlSchemaSequence) {
            XmlSchemaSequence sequence = (XmlSchemaSequence)complexType.getParticle();
            addCrossImports(schema, sequence);
        }
    }
}
 
Example #5
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 5 votes vote down vote up
private MemberType processAllMember(XmlSchemaAll all, QName defaultName,
    QName schemaTypeName) throws Exception {

    CorbaType corbatype = processAllType(all, defaultName, schemaTypeName);
    MemberType member = new MemberType();
    member.setName(corbatype.getQName().getLocalPart());
    member.setIdltype(corbatype.getQName());
    if (corbatype.isSetQualified() && corbatype.isQualified()) {
        member.setQualified(true);
    }
    return member;
}
 
Example #6
Source File: SchemaCollection.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addCrossImports(XmlSchema schema, XmlSchemaAll all) {
    for (XmlSchemaObjectBase seqMember : all.getItems()) {
        if (seqMember instanceof XmlSchemaElement) {
            addElementCrossImportsElement(schema, (XmlSchemaElement)seqMember);
        }
    }
}
 
Example #7
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 4 votes vote down vote up
private Struct processComplexContentStructParticle(XmlSchemaParticle extype,
                                              QName defaultName, Struct corbaStruct,
                                              QName schematypeName, QName extName,
                                              List<XmlSchemaAttributeOrGroupRef> list)
    throws Exception {

    String uri;
    if (schematypeName != null) {
        uri = schematypeName.getNamespaceURI();
    } else {
        uri = defaultName.getNamespaceURI();
    }

    // Add base as a member of this struct
    MemberType memberType = new MemberType();
    memberType.setName(extName.getLocalPart() + "_f");
    if ("anyType".equals(extName.getLocalPart())) {
        memberType.setIdltype(processPrimitiveType(extName).getQName());
    } else {
        memberType.setIdltype(createQNameCorbaNamespace(extName.getLocalPart()));
    }
    corbaStruct.getMember().add(memberType);

    // process attributes at complexContent level
    List<MemberType> attlist1 = processAttributesAsMembers(list, uri);
    for (int i = 0; i < attlist1.size(); i++) {
        MemberType member = attlist1.get(i);
        corbaStruct.getMember().add(member);
    }

    // Process members of Current Type
    if (extype instanceof XmlSchemaChoice) {
        XmlSchemaChoice choice = (XmlSchemaChoice)extype;
        MemberType choicemem = processComplexContentStructChoice(choice, schematypeName, defaultName);
        choicemem.setAnonschematype(true);
        corbaStruct.getMember().add(choicemem);
    } else if (extype instanceof  XmlSchemaSequence) {
        XmlSchemaSequence seq = (XmlSchemaSequence)extype;
        corbaStruct = processComplexContentStructSequence(corbaStruct, seq, defaultName, schematypeName);
    } else if (extype instanceof  XmlSchemaAll) {
        XmlSchemaAll all = (XmlSchemaAll)extype;
        corbaStruct = processComplexContentStructSchemaAll(corbaStruct, all,
                                                     defaultName, schematypeName);
    }
    return corbaStruct;
}