Examples of XmlSchemaSequence


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

        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++) {
            XmlSchemaObject o = seq.getItems().getItem(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement a = (XmlSchemaElement)o;
                if ("bleh".equals(a.getName())) {
                    bleh = true;
                }
View Full Code Here

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

        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);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("int1".equals(oe.getName())) {
                    int1ok = true;
                    assertTrue(oe.isNillable());
View Full Code Here

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

        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);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("item".equals(oe.getName())) {
                    itemFound = true;
                    assertTrue(oe.isNillable());
View Full Code Here

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

        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) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("int1".equals(oe.getName())) {
                    int1ok = true;
                    assertFalse(oe.isNillable());
View Full Code Here

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

       
        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);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("character".equals(oe.getName())) {
                    charok = true;
                    assertNotNull(oe.getSchemaTypeName());
View Full Code Here

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

        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++) {
            XmlSchemaObject o = seq.getItems().getItem(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("littleByte".equals(oe.getName())) {
                    littleByteOk = true;
                    assertNotNull(oe.getSchemaTypeName());
View Full Code Here

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

        XmlSchemaComplexType complex = new XmlSchemaComplexType(root);
        complex.setName(getSchemaType().getLocalPart());
        root.addType(complex);
        root.getItems().add(complex);

        XmlSchemaSequence seq = new XmlSchemaSequence();
        complex.setParticle(seq);

        AegisType componentType = getComponentType();
        XmlSchemaElement element = new XmlSchemaElement();
        element.setName(componentType.getSchemaType().getLocalPart());
        element.setSchemaTypeName(componentType.getSchemaType());

        seq.getItems().add(element);

        if (componentType.isNillable()) {
            element.setNillable(true);
        }
View Full Code Here

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

            part.setXmlSchema(el);

            XmlSchemaComplexType ct = new XmlSchemaComplexType(schemaInfo.getSchema());
            el.setSchemaType(ct);
            XmlSchemaSequence seq = new XmlSchemaSequence();
            ct.setParticle(seq);
               
            Method methods[] = cls.getMethods();
            for (Method m : methods) {
                if (m.getName().startsWith("get")
                    || m.getName().startsWith("is")) {
                    int beginIdx = m.getName().startsWith("get") ? 3 : 2;
                    try {
                        m.getDeclaringClass().getMethod("set" + m.getName().substring(beginIdx),
                                                        m.getReturnType());
                       
                        JAXBBeanInfo beanInfo = getBeanInfo(m.getReturnType());
                        if (beanInfo != null) {
                            el = new XmlSchemaElement();
                            el.setName(m.getName().substring(beginIdx));
                           
                            String ns = schemaInfo.getSchema().getElementFormDefault()
                                .getValue().equals(XmlSchemaForm.UNQUALIFIED)
                                ? "" : part.getElementQName().getLocalPart();
                            XmlSchemaUtils.setElementQName(el,
                                                           new QName(ns, m.getName().substring(beginIdx)));
                            Iterator<QName> itr = beanInfo.getTypeNames().iterator();
                            if (!itr.hasNext()) {
                                return;
                            }
                            QName typeName = itr.next();
                            el.setSchemaTypeName(typeName);
                        }
                       
                        seq.getItems().add(el);
                    } catch (Exception e) {
                        //not mappable
                    }
                }
            }
View Full Code Here

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

        schema.getItems().add(ct);
        schema.addType(ct);
        schemaInfo.setElement(null);
        el.setSchemaTypeName(part.getElementQName());
       
        XmlSchemaSequence seq = new XmlSchemaSequence();
        ct.setParticle(seq);
        String namespace = part.getElementQName().getNamespaceURI();
       
        XmlAccessorType accessorType = cls.getAnnotation(XmlAccessorType.class);
        if (accessorType == null && cls.getPackage() != null) {
            accessorType = cls.getPackage().getAnnotation(XmlAccessorType.class);
        }
        XmlAccessType accessType = accessorType != null ? accessorType.value() : XmlAccessType.PUBLIC_MEMBER;

       
        for (Field f : cls.getDeclaredFields()) {
            if (JAXBContextInitializer.isFieldAccepted(f, accessType)) {
                //map field
                Type type = f.getGenericType();
                JAXBBeanInfo beanInfo = getBeanInfo(type);
                if (beanInfo != null) {
                    addElement(seq, beanInfo, new QName(namespace, f.getName()), isArray(type));
                }               
            }
        }
        for (Method m : cls.getMethods()) {
            if (JAXBContextInitializer.isMethodAccepted(m, accessType)) {
                //map field
                Type type = m.getGenericReturnType();
                JAXBBeanInfo beanInfo = getBeanInfo(type);
                if (beanInfo != null) {
                    int idx = m.getName().startsWith("get") ? 3 : 2;
                    String name = m.getName().substring(idx);
                    name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
                    addElement(seq, beanInfo, new QName(namespace, name), isArray(type));
                }               
            }
        }
        // Create element in xsd:sequence for Exception.class
        if (cls.equals(Exception.class)) {
            JAXBBeanInfo beanInfo = getBeanInfo(java.lang.String.class);
            XmlSchemaElement exEle = new XmlSchemaElement();
            exEle.setName("message");
            exEle.setSchemaTypeName(getTypeName(beanInfo));
            exEle.setMinOccurs(0);
            seq.getItems().add(exEle);

        }
        part.setProperty(JAXBDataBinding.class.getName() + ".CUSTOM_EXCEPTION", Boolean.TRUE);
    }
View Full Code Here

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

        if (((inf.getTypeClass().getModifiers() & Modifier.ABSTRACT) != 0)
            && !inf.getTypeClass().isInterface()) {
            complex.setAbstract(true);
        }

        XmlSchemaSequence sequence = new XmlSchemaSequence();
        /*
         * Decide if we're going to extend another type. If we are going to defer, then make sure that we
         * extend the type for our superclass.
         */
        boolean isExtension = inf.isExtension();

        if (isExtension && sooperType != null) {
            // if sooperType is null, things are confused.
            XmlSchemaComplexContent content = new XmlSchemaComplexContent();
            complex.setContentModel(content);
            XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension();
            content.setContent(extension);
            extension.setBaseTypeName(sooperType.getSchemaType());
            extension.setParticle(sequence);
        } else {
            complex.setParticle(sequence);
        }

        boolean needXmime = false;
        boolean needUtilityTypes = false;

        // Write out schema for elements
        for (QName name : inf.getElements()) {

            if (isExtension) {
                PropertyDescriptor pd = inf.getPropertyDescriptorFromMappedName(name);

                // assert pd.getReadMethod() != null && pd.getWriteMethod() != null;

                if (pd.getReadMethod().getDeclaringClass() != inf.getTypeClass()) {
                    continue;
                }
            }

            XmlSchemaElement element = new XmlSchemaElement();
            element.setName(name.getLocalPart());
            sequence.getItems().add(element);

            AegisType type = getType(inf, name);
            if (type.isFlatArray()) {
                // ok, we need some tricks here
                element.setMinOccurs(type.getMinOccurs());
                element.setMaxOccurs(type.getMaxOccurs());
                // for now, assume ArrayType. Look at lists or more general solutions later.
                ArrayType aType = (ArrayType)type;
                type = aType.getComponentType();
                element.setNillable(type.isNillable());
            } else {
                if (AbstractTypeCreator.
                    HTTP_CXF_APACHE_ORG_ARRAYS.equals(type.getSchemaType().getNamespaceURI())) {
                    XmlSchemaUtils.addImportIfNeeded(root, AbstractTypeCreator.HTTP_CXF_APACHE_ORG_ARRAYS);
                }
            }
            writeTypeReference(name, element, type, root);
            needXmime |= type.usesXmime();
            needUtilityTypes |= type.usesUtilityTypes();

        }

        if (needXmime) {
            addXmimeToSchema(root);
        }

        if (needUtilityTypes) {
            AegisContext.addUtilityTypesToSchema(root);
        }

        /**
         * if future proof then add <xsd:any/> element
         */
        if (inf.isExtensibleElements()) {
            XmlSchemaAny any = new XmlSchemaAny();
            any.setMinOccurs(0);
            any.setMaxOccurs(Long.MAX_VALUE);
            sequence.getItems().add(any);
        }

        // Write out schema for attributes
        for (QName name : inf.getAttributes()) {
            XmlSchemaAttribute attribute = new XmlSchemaAttribute();
            complex.getAttributes().add(attribute);
            attribute.setName(name.getLocalPart());
            AegisType type = getType(inf, name);
            attribute.setSchemaTypeName(type.getSchemaType());
            String ns = name.getNamespaceURI();
            if (!ns.equals(root.getTargetNamespace())) {
                XmlSchemaUtils.addImportIfNeeded(root, ns);
            }
        }

        /**
         * If extensible attributes then add <xsd:anyAttribute/>
         */
        if (inf.isExtensibleAttributes()) {
            sequence.getItems().add(new XmlSchemaAnyAttribute());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.