Package org.apache.ws.commons.schema

Examples of org.apache.ws.commons.schema.XmlSchema


            QName contextQName = inputWrapperComplexType.getQName();
            if (contextQName == null) {
                contextQName = inputWrapperElement.getQName();
            }
            XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(inputWrapperComplexType);
            XmlSchema wrapperSchema =
                xmlSchemaCollection.getSchemaByTargetNamespace(contextQName.getNamespaceURI());

            for (int i = 0; i < sequence.getItems().getCount(); i++) {
                code.append("// parameter " + inputParameterNames.get(i) + "\n");
                XmlSchemaObject sequenceItem = sequence.getItems().getItem(i);
View Full Code Here


        // Test writing
        Element element = writeObjectToElement(type, bean, getContext());
        assertValid("/b:root[@b:bleh='bleh']", element);
        assertValid("/b:root[@b:howdy='howdy']", element);
       
        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);
       
        XmlSchemaComplexType stype = (XmlSchemaComplexType)schema.getTypeByName("bean");
        boolean howdy = false;
        boolean bleh = false;
        for (int x = 0; x < stype.getAttributes().getCount(); x++) {
            XmlSchemaObject o = stype.getAttributes().getItem(x);
            if (o instanceof XmlSchemaAttribute) {
View Full Code Here

        Element element = writeObjectToElement(type, bean, getContext());

        assertInvalid("/b:root[@b:howdy]", element);
        assertValid("/b:root/b:bleh[@xsi:nil='true']", element);

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);
       
        XmlSchemaComplexType stype = (XmlSchemaComplexType)schema.getTypeByName("bean");
        XmlSchemaSequence seq = (XmlSchemaSequence) stype.getParticle();
        boolean howdy = false;
        boolean bleh = false;

        for (int x = 0; x < seq.getItems().getCount(); x++) {
View Full Code Here

        BeanType type = new BeanType(info);
        type.setTypeClass(IntBean.class);
        type.setTypeMapping(mapping);
        type.setSchemaType(new QName("urn:Bean", "bean"));

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);
       
        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("bean");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean int1ok = false;
        boolean int2ok = false;
        for (int x = 0; x < seq.getItems().getCount(); x++) {
            XmlSchemaObject o = seq.getItems().getItem(x);
View Full Code Here

        BeanType type = (BeanType)mapping.getTypeCreator().createType(BeanWithNillableItem.class);
        type.setTypeClass(BeanWithNillableItem.class);
        type.setTypeMapping(mapping);

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);
       
        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("BeanWithNillableItem");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean itemFound = false;
        boolean itemNotNillableFound = false;
        for (int x = 0; x < seq.getItems().getCount(); x++) {
            XmlSchemaObject o = seq.getItems().getItem(x);
View Full Code Here

        BeanType type = (BeanType)mapping.getTypeCreator().createType(IntBean.class);
        type.setTypeClass(IntBean.class);
        type.setTypeMapping(mapping);

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);
       
        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("IntBean");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean int1ok = false;
        for (int x = 0; x < seq.getItems().getCount(); x++) {
            XmlSchemaObject o = seq.getItems().getItem(x);
            if (o instanceof XmlSchemaElement) {
View Full Code Here

        BeanType type = (BeanType)mapping.getTypeCreator().createType(SimpleBean.class);
        type.setTypeClass(SimpleBean.class);
        type.setTypeMapping(mapping);
       
        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);
       
        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("SimpleBean");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean charok = false;

        for (int x = 0; x < seq.getItems().getCount(); x++) {
            XmlSchemaObject o = seq.getItems().getItem(x);
View Full Code Here

        BeanType type = (BeanType)mapping.getTypeCreator().createType(SimpleBean.class);
        type.setTypeClass(SimpleBean.class);
        type.setTypeMapping(mapping);

        XmlSchema schema = newXmlSchema("urn:Bean");
        type.writeSchema(schema);
       
        XmlSchemaComplexType btype = (XmlSchemaComplexType)schema.getTypeByName("SimpleBean");
        XmlSchemaSequence seq = (XmlSchemaSequence)btype.getParticle();
        boolean littleByteOk = false;
        boolean bigByteOk = false;

        for (int x = 0; x < seq.getItems().getCount(); x++) {
View Full Code Here

       
        schemaInfo = new SchemaInfo(qn.getNamespaceURI(), qualifiedSchemas, false);
       
        el = createXsElement(part, typeName, schemaInfo);

        XmlSchema schema = schemas.newXmlSchemaInCollection(qn.getNamespaceURI());
        if (qualifiedSchemas) {
            schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
        }
        schemaInfo.setSchema(schema);
        schema.getElements().add(el.getQName(), el);
        schema.getItems().add(el);

        NamespaceMap nsMap = new NamespaceMap();
        nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, schema.getTargetNamespace());
        nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
        schema.setNamespaceContext(nsMap);
       
        serviceInfo.addSchema(schemaInfo);
    }
View Full Code Here

            if (s.getNamespaceURI().equals(part.getElementQName().getNamespaceURI())) {
                schemaInfo = s;               
                break;
            }
        }
        XmlSchema schema;
        if (schemaInfo == null) {
            schema = schemas.newXmlSchemaInCollection(part.getElementQName().getNamespaceURI());

            if (qualifiedSchemas) {
                schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
            }

            NamespaceMap nsMap = new NamespaceMap();
            nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, schema.getTargetNamespace());
            nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
            schema.setNamespaceContext(nsMap);

           
            schemaInfo = new SchemaInfo(part.getElementQName().getNamespaceURI());
            schemaInfo.setSchema(schema);
            serviceInfo.addSchema(schemaInfo);
        } else {
            schema = schemaInfo.getSchema();
        }
       
        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
        ct.setName(part.getElementQName().getLocalPart());
        // Before updating everything, make sure we haven't added this
        // type yet.  Multiple methods that throw the same exception
        // types will cause duplicates.
        if (schema.getTypeByName(ct.getQName()) != null) {
            return;
        }
       
        XmlSchemaElement el = new XmlSchemaElement();
        XmlSchemaUtils.setElementQName(el, part.getElementQName());
        schema.getItems().add(el);
        schema.getElements().add(el.getQName(), el);
        part.setXmlSchema(el);
       
        schema.getItems().add(ct);
        schema.addType(ct);
        schemaInfo.setElement(null);
        el.setSchemaTypeName(part.getElementQName());
       
        XmlSchemaSequence seq = new XmlSchemaSequence();
        ct.setParticle(seq);
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.schema.XmlSchema

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.