Package org.apache.ws.commons.schema

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


       
            XmlSchemaSequence stype = (XmlSchemaSequence)type.getParticle();               

            if (stype.getItems().getCount() == 2) {
                Iterator it = stype.getItems().getIterator();
                XmlSchemaParticle st1 = (XmlSchemaParticle)it.next();
                XmlSchemaParticle st2 = (XmlSchemaParticle)it.next();
                XmlSchemaElement discEl = null;

                if (st1 instanceof XmlSchemaChoice && st2 instanceof XmlSchemaElement) {
                    isUnion = true;
                    discEl = (XmlSchemaElement)st2;
View Full Code Here


    private Iterator getSchemaIterator(XmlSchemaType schemaType) {

        if (schemaType instanceof XmlSchemaComplexType) {
            XmlSchemaComplexType cpt = (XmlSchemaComplexType) schemaType;
            XmlSchemaParticle particle = null;
            if (cpt.getParticle() != null) {
                particle = (XmlSchemaParticle) cpt.getParticle();

                if (particle instanceof XmlSchemaSequence) {
                    XmlSchemaSequence seq = (XmlSchemaSequence) particle;
View Full Code Here

    }

    private static boolean checkComplex(XmlSchemaComplexType cpt)
        throws Exception {

        XmlSchemaParticle particle = (XmlSchemaParticle) cpt.getParticle();
        if (particle == null) {
            return true;
        }

        if (!(particle instanceof XmlSchemaSequence)) {
View Full Code Here

     * @return
     */
    public static ParticleInfo forLocalItem(XmlSchemaObject sequenceObject, XmlSchema currentSchema,
                                            SchemaCollection schemaCollection,
                                            NamespacePrefixAccumulator prefixAccumulator, QName contextName) {
        XmlSchemaParticle sequenceParticle = XmlSchemaUtils.getObjectParticle(sequenceObject, contextName);
        ParticleInfo elementInfo = new ParticleInfo();
        XmlSchemaParticle realParticle = sequenceParticle;

        if (sequenceParticle instanceof XmlSchemaElement) {
            XmlSchemaElement sequenceElement = (XmlSchemaElement)sequenceParticle;

            if (sequenceElement.getRefName() != null) {
View Full Code Here

            // element corresponds to the type of the parameter. So, we refocus on that.
            if (!empty
                && type instanceof XmlSchemaComplexType
                && type.getName() == null
                && !isWrapped) {
                XmlSchemaParticle betterElement = getBuriedElement((XmlSchemaComplexType) type,
                                                                  diagnosticName);
                if (betterElement instanceof XmlSchemaElement) {
                    element = (XmlSchemaElement)betterElement;
                    if (element.getSchemaType() == null) {
                        if (element.getSchemaTypeName() != null) {
View Full Code Here

        if (!(content instanceof XmlSchemaComplexContentExtension)) {
            return null;
        }
   
        XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension)content;
        XmlSchemaParticle particle = ext.getParticle();
        if (particle == null) {
            return null;
        }
        XmlSchemaSequence sequence = null;
        try {
View Full Code Here

        }
        return null;
    }

    public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) {
        XmlSchemaParticle particle = type.getParticle();
        XmlSchemaSequence sequence = null;
       
        if (particle == null) {
            // the code that uses this wants to iterate. An empty one is more useful than
            // a null pointer, and certainly an exception.
View Full Code Here

        }
        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) {
                addCrossImportsSequence(schema, (XmlSchemaSequence)particle);
            }
        } else if (content instanceof XmlSchemaComplexContentRestriction) {
            XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
View Full Code Here

            XmlSchemaComplexType ctype = (XmlSchemaComplexType)type;
            if (ctype.getAttributes().getCount() != 0) {
                throw new RuntimeException("Cannot unwrap element " +
                    qname + ": attributes not allowed on type to be unwrapped");
            }
            XmlSchemaParticle particle = ctype.getParticle();
            if (particle != null) {
               
                // if there's a particle present, it must be a sequence
                if (!(particle instanceof XmlSchemaSequence)) {
                    throw new RuntimeException("Cannot unwrap element " +
                        qname + ": type to be unwrapped must be a sequence");
                }
                if (particle.getMinOccurs() != 1 || particle.getMaxOccurs() != 1) {
                    throw new RuntimeException("Cannot unwrap element " +
                        qname + ": contained sequence must have minOccurs='1' and maxOccurs='1'");
                }
                XmlSchemaSequence sequence = (XmlSchemaSequence)particle;
               
                // add child param element matching each child of wrapper element
                QName opName = ((AxisOperation)msg.getParent()).getName();
                XmlSchemaObjectCollection items = sequence.getItems();
                boolean first = true;
                for (Iterator iter = items.getIterator(); iter.hasNext();) {
                   
                    // check that child item obeys the unwrapping rules
                    XmlSchemaParticle item = (XmlSchemaParticle)iter.next();
                    if (!(item instanceof XmlSchemaElement)) {
                        throw new RuntimeException("Cannot unwrap element " +
                            qname + ": only element items allowed in seqence");
                    }
                    XmlSchemaElement element = (XmlSchemaElement)item;
View Full Code Here

        if (!(content instanceof XmlSchemaComplexContentExtension)) {
            return null;
        }

        XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension)content;
        XmlSchemaParticle particle = ext.getParticle();
        if (particle == null) {
            return null;
        }
        XmlSchemaSequence sequence = null;
        try {
View Full Code Here

TOP

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

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.