Search in sources :

Example 6 with XmlSchemaSimpleContentExtension

use of org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension in project cxf by apache.

the class SchemaCollection method addCrossImports.

private void addCrossImports(XmlSchema schema, XmlSchemaContentModel contentModel) {
    if (contentModel == null) {
        return;
    }
    XmlSchemaContent content = contentModel.getContent();
    if (content == null) {
        return;
    }
    if (content instanceof XmlSchemaComplexContentExtension) {
        XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension) content;
        XmlSchemaUtils.addImportIfNeeded(schema, extension.getBaseTypeName());
        addCrossImportsAttributeList(schema, extension.getAttributes());
        XmlSchemaParticle particle = extension.getParticle();
        if (particle instanceof XmlSchemaSequence) {
            addCrossImports(schema, (XmlSchemaSequence) particle);
        } else if (particle instanceof XmlSchemaChoice) {
            addCrossImports(schema, (XmlSchemaChoice) particle);
        } else if (particle instanceof XmlSchemaAll) {
            addCrossImports(schema, (XmlSchemaAll) particle);
        }
    } else if (content instanceof XmlSchemaComplexContentRestriction) {
        XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
        XmlSchemaUtils.addImportIfNeeded(schema, restriction.getBaseTypeName());
        addCrossImportsAttributeList(schema, restriction.getAttributes());
    } else if (content instanceof XmlSchemaSimpleContentExtension) {
        XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content;
        XmlSchemaUtils.addImportIfNeeded(schema, extension.getBaseTypeName());
        addCrossImportsAttributeList(schema, extension.getAttributes());
    } else if (content instanceof XmlSchemaSimpleContentRestriction) {
        XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) content;
        XmlSchemaUtils.addImportIfNeeded(schema, restriction.getBaseTypeName());
        addCrossImportsAttributeList(schema, restriction.getAttributes());
    }
}
Also used : XmlSchemaComplexContentExtension(org.apache.ws.commons.schema.XmlSchemaComplexContentExtension) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaSimpleContentExtension(org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension) XmlSchemaAll(org.apache.ws.commons.schema.XmlSchemaAll) XmlSchemaContent(org.apache.ws.commons.schema.XmlSchemaContent) XmlSchemaChoice(org.apache.ws.commons.schema.XmlSchemaChoice) XmlSchemaComplexContentRestriction(org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) XmlSchemaSimpleContentRestriction(org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction)

Example 7 with XmlSchemaSimpleContentExtension

use of org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension in project cxf by apache.

the class CustomStringType method writeSchema.

@Override
public void writeSchema(XmlSchema root) {
    // this mapping gets used with xs:string, and we might get called.
    if (root.getTargetNamespace().equals(XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
        return;
    }
    XmlSchemaSimpleType type = new XmlSchemaSimpleType(root, true);
    type.setName(getSchemaType().getLocalPart());
    XmlSchemaSimpleContentExtension ext = new XmlSchemaSimpleContentExtension();
    ext.setBaseTypeName(Constants.XSD_STRING);
    XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction();
    content.setBaseTypeName(Constants.XSD_STRING);
    type.setContent(content);
}
Also used : XmlSchemaSimpleContentExtension(org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaSimpleTypeRestriction(org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction)

Example 8 with XmlSchemaSimpleContentExtension

use of org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension in project cxf by apache.

the class WSDLToCorbaHelper method processSimpleContentStruct.

protected Struct processSimpleContentStruct(XmlSchemaSimpleContent simpleContent, QName defaultName, Struct corbaStruct, QName schematypeName) throws Exception {
    List<MemberType> attrMembers = null;
    CorbaType basetype = null;
    String uri;
    if (schematypeName != null) {
        uri = schematypeName.getNamespaceURI();
    } else {
        uri = defaultName.getNamespaceURI();
    }
    if (simpleContent.getContent() instanceof XmlSchemaSimpleContentExtension) {
        XmlSchemaSimpleContentExtension ext = (XmlSchemaSimpleContentExtension) simpleContent.getContent();
        if (ext.getBaseTypeName() != null) {
            basetype = processPrimitiveType(ext.getBaseTypeName());
        }
        if (basetype == null) {
            XmlSchemaType base = getSchemaType(ext.getBaseTypeName());
            basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
        }
        if (basetype == null) {
            return null;
        }
        // process ext types ????
        MemberType basemember = new MemberType();
        basemember.setName("_simpleTypeValue");
        QName baseTypeName = checkPrefix(basetype.getQName());
        basemember.setIdltype(baseTypeName);
        corbaStruct.getMember().add(basemember);
        if (!isDuplicate(basetype)) {
            typeMappingType.getStructOrExceptionOrUnion().add(basetype);
        }
        attrMembers = processAttributesAsMembers(ext.getAttributes(), uri);
    } else if (simpleContent.getContent() instanceof XmlSchemaSimpleContentRestriction) {
        XmlSchemaSimpleContentRestriction restrict = (XmlSchemaSimpleContentRestriction) simpleContent.getContent();
        if (restrict.getBaseTypeName() != null) {
            basetype = processPrimitiveType(restrict.getBaseTypeName());
        }
        if (basetype == null) {
            XmlSchemaType base = getSchemaType(restrict.getBaseTypeName());
            basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
        }
        MemberType basemember = new MemberType();
        basemember.setName("_simpleTypeValue");
        QName baseTypeName = checkPrefix(basetype.getQName());
        basemember.setIdltype(baseTypeName);
        corbaStruct.getMember().add(basemember);
        if (!isDuplicate(basetype)) {
            typeMappingType.getStructOrExceptionOrUnion().add(basetype);
        }
        attrMembers = processAttributesAsMembers(restrict.getAttributes(), uri);
    }
    // Deal with Attributes defined in Extension
    if (attrMembers != null) {
        for (int i = 0; i < attrMembers.size(); i++) {
            MemberType member = attrMembers.get(i);
            corbaStruct.getMember().add(member);
        }
    }
    return corbaStruct;
}
Also used : XmlSchemaSimpleContentExtension(org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) MemberType(org.apache.cxf.binding.corba.wsdl.MemberType) QName(javax.xml.namespace.QName) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaSimpleContentRestriction(org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction)

Aggregations

XmlSchemaSimpleContentExtension (org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension)8 XmlSchemaSimpleContentRestriction (org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction)7 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)6 XmlSchemaContent (org.apache.ws.commons.schema.XmlSchemaContent)6 XmlSchemaComplexContentRestriction (org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction)5 QName (javax.xml.namespace.QName)3 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)3 XmlSchemaContentModel (org.apache.ws.commons.schema.XmlSchemaContentModel)3 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)3 XmlSchemaAll (org.apache.ws.commons.schema.XmlSchemaAll)2 XmlSchemaChoice (org.apache.ws.commons.schema.XmlSchemaChoice)2 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)2 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)2 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)2 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)1 DefaultPropertyDefinition (eu.esdihumboldt.hale.common.schema.model.impl.DefaultPropertyDefinition)1 ComplexContentHasValue (eu.esdihumboldt.hale.io.xsd.model.ComplexContentHasValue)1 AnonymousXmlType (eu.esdihumboldt.hale.io.xsd.reader.internal.AnonymousXmlType)1 SubstitutionGroupProperty (eu.esdihumboldt.hale.io.xsd.reader.internal.SubstitutionGroupProperty)1 XmlElementReferenceProperty (eu.esdihumboldt.hale.io.xsd.reader.internal.XmlElementReferenceProperty)1