Package org.apache.ws.commons.schema

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


                if (particle instanceof XmlSchemaSequence) {
                    XmlSchemaSequence seq = (XmlSchemaSequence) particle;
                    return seq.getItems().getIterator();
                } else if (particle instanceof XmlSchemaChoice) {
                    XmlSchemaChoice choice = (XmlSchemaChoice) particle;
                    return choice.getItems().getIterator();
                }
            }
            if (cpt.getContentModel() != null) {
                XmlSchemaContentModel xscm = (XmlSchemaContentModel) cpt
                        .getContentModel();
                if (xscm instanceof XmlSchemaComplexContent) {
                    XmlSchemaComplexContent xscc = (XmlSchemaComplexContent) xscm;

                    XmlSchemaComplexContentExtension ext = null;
                    if (xscc.getContent() instanceof XmlSchemaComplexContentExtension) {
                        ext = (XmlSchemaComplexContentExtension) xscc
                                .getContent();
                    }
                    if (ext.getParticle() instanceof XmlSchemaSequence) {
                        XmlSchemaSequence seq = (XmlSchemaSequence) ext
                                .getParticle();
                        return seq.getItems().getIterator();
                    } else if (ext.getParticle() instanceof XmlSchemaChoice) {
                        XmlSchemaChoice choice = (XmlSchemaChoice) ext
                                .getParticle();
                        return choice.getItems().getIterator();
                    }
                }
            }
        }
        return null;
View Full Code Here


        discriminatorElement.setSchemaTypeName(stype.getQName());
        discriminatorElement.setMinOccurs(1);
        discriminatorElement.setMaxOccurs(1);
        sequence.getItems().add(discriminatorElement);
       
        XmlSchemaChoice choice = new XmlSchemaChoice();
        choice.setMinOccurs(1);
        choice.setMaxOccurs(1);
        sequence.getItems().add(choice);
       
       
        // corba:union
        Union corbaUnion = new Union();
View Full Code Here

                                                    TypeCode tc,
                                                    XmlSchemaObject schemaType)
        throws CorbaBindingException {
        CorbaUnionHandler obj = null;
        try {
            XmlSchemaChoice choiceType = (XmlSchemaChoice) schemaType;
            Union unionType = (Union) CorbaUtils.getCorbaType(idlType, typeMaps);
            QName elName = reader.nextEvent().asStartElement().getName();
            obj = new CorbaUnionHandler(elName, idlType, tc, unionType);
            // Build the entire union with all branches, etc.  Then read info from the XML Event Reader
            String branchName = null;
            XMLEvent evt = reader.peek();
            if (evt.isStartElement()) {
                StartElement branchElement = evt.asStartElement();
                branchName = branchElement.getName().getLocalPart();
            }
            List<Unionbranch> branches = unionType.getUnionbranch();
            XmlSchemaObjectCollection items = choiceType.getItems();               
            for (int i = 0; i < branches.size(); i++) {
                Unionbranch branch = branches.get(i);
                CorbaObjectHandler branchObj = null;
                if (branch.getName().equals(branchName)) {
                    branchObj = readObjectFromStax(reader, branch.getIdltype(), items.getItem(i), true);
View Full Code Here

        return sequence;
    }
    public static XmlSchemaChoice getChoice(XmlSchemaComplexType type) {
        XmlSchemaParticle particle = type.getParticle();
        XmlSchemaChoice choice = 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.
            return EMPTY_CHOICE;
View Full Code Here

        Iterator iterL = null;
        if (particle instanceof XmlSchemaSequence) {
            XmlSchemaSequence scontainer = (XmlSchemaSequence)particle;
            iterL = scontainer.getItems().getIterator();
        } else if (particle instanceof XmlSchemaChoice) {
            XmlSchemaChoice scontainer = (XmlSchemaChoice)particle;
            iterL = scontainer.getItems().getIterator();
        } else if (particle instanceof XmlSchemaAll) {
            XmlSchemaAll acontainer = (XmlSchemaAll)particle;
            iterL = acontainer.getItems().getIterator();
        }

        while (iterL.hasNext()) {
            XmlSchemaParticle container = (XmlSchemaParticle)iterL.next();
           
            if (container instanceof XmlSchemaSequence) {
                XmlSchemaSequence sequence = (XmlSchemaSequence)container;
                CorbaTypeImpl memberType = processSequenceType(sequence, defaultName, schemaTypeName);
                QName typeName = memberType.getQName();
                if (memberType instanceof Struct) {
                    memberType.setQName(null);                 
                    if (memberType != null && !isDuplicate(memberType)) {
                        typeMappingType.getStructOrExceptionOrUnion().add(memberType);
                    }                   
                }
               
                MemberType member = new MemberType();
                member.setName(memberType.getName() + "_f");
                member.setIdltype(typeName);
                members.add(member);

            } else if (container instanceof XmlSchemaChoice) {
                XmlSchemaChoice choice = (XmlSchemaChoice)container;
                CorbaTypeImpl corbatype = processChoice(choice, defaultName, schemaTypeName);
                MemberType member = new MemberType();
                member.setName(corbatype.getQName().getLocalPart());
                member.setIdltype(corbatype.getQName());
                members.add(member);
View Full Code Here

                corbaStruct.getMember().add(member);
            }
           
            // Process members of Current Type
            if (extype.getParticle() instanceof XmlSchemaChoice) {
                XmlSchemaChoice choice = (XmlSchemaChoice)extype.getParticle();
                MemberType choicemem = processComplexContentStructChoice(choice, schematypeName, defaultName);
                corbaStruct.getMember().add(choicemem);                               
            } else if (extype.getParticle() instanceof  XmlSchemaSequence) {
                XmlSchemaSequence seq = (XmlSchemaSequence)extype.getParticle();
                CorbaTypeImpl seqtype =
View Full Code Here

        XmlSchemaSequence stype = (XmlSchemaSequence)complex.getParticle();
        Iterator it = stype.getItems().getIterator();
        XmlSchemaParticle st1 = (XmlSchemaParticle)it.next();
        XmlSchemaParticle st2 = (XmlSchemaParticle)it.next();
        XmlSchemaElement discEl = null;
        XmlSchemaChoice choice = null;

        if (st1 instanceof XmlSchemaElement) {
            discEl = (XmlSchemaElement)st1;
            choice = (XmlSchemaChoice)st2;
        } else {
View Full Code Here

        } else if (particle instanceof XmlSchemaAll) {
            List<XmlSchemaElement> items = ((XmlSchemaAll) particle).getItems();
            processSchemaAllItems(parentElementQName, items, metainfHolder, false, parentSchema);
        } else if (particle instanceof XmlSchemaChoice) {
            XmlSchemaChoice xmlSchemaChoice = (XmlSchemaChoice) particle;
            List<XmlSchemaObject> items = ((XmlSchemaChoice) particle).getItems();

            if ((xmlSchemaChoice.getMaxOccurs() > 1)) {
                // we have to process many sequence types
                BeanWriterMetaInfoHolder beanWriterMetaInfoHolder = new BeanWriterMetaInfoHolder();
                beanWriterMetaInfoHolder.setChoice(true);
                processChoiceItems(parentElementQName, items, beanWriterMetaInfoHolder, false,
                                   parentSchema);
                beanWriterMetaInfoHolder.setParticleClass(true);
                QName choiceQName = new QName(parentElementQName.getNamespaceURI(),
                                              parentElementQName.getLocalPart() + "Choice");
                String javaClassName = writeComplexParticle(choiceQName, beanWriterMetaInfoHolder);
                processedTypemap.put(choiceQName, javaClassName);

                // add this as an array to the original class
                metainfHolder.registerMapping(choiceQName,
                                              choiceQName,
                                              findClassName(choiceQName, true),
                                              SchemaConstants.ARRAY_TYPE);
                metainfHolder.setOrdered(true);
                metainfHolder.setHasParticleType(true);
                metainfHolder.registerQNameIndex(choiceQName, metainfHolder.getOrderStartPoint() + 1);
                metainfHolder.addtStatus(choiceQName, SchemaConstants.PARTICLE_TYPE_ELEMENT);
                metainfHolder.addMaxOccurs(choiceQName, xmlSchemaChoice.getMaxOccurs());
                metainfHolder.addMinOccurs(choiceQName, xmlSchemaChoice.getMinOccurs());

            } else {
                metainfHolder.setChoice(true);
                processChoiceItems(parentElementQName, items, metainfHolder, false, parentSchema);
            }
View Full Code Here

                    metainfHolder.registerQNameIndex(sequenceQName,
                                                     startingItemNumberOrder +
                                                     elementOrderMap.get(child));
                }
            } else if (child instanceof XmlSchemaChoice) {
                XmlSchemaChoice xmlSchemaChoice = (XmlSchemaChoice) child;
                QName choiceQName = particleQNameMap.get(child);
                boolean isArray = xmlSchemaChoice.getMaxOccurs() > 1;

                // add this as an array to the original class
                metainfHolder.registerMapping(choiceQName,
                                              choiceQName,
                                              findClassName(choiceQName, isArray));
                if (isArray) {
                    metainfHolder.addtStatus(choiceQName, SchemaConstants.ARRAY_TYPE);
                }
                metainfHolder.addtStatus(choiceQName, SchemaConstants.PARTICLE_TYPE_ELEMENT);
                metainfHolder.addMaxOccurs(choiceQName, xmlSchemaChoice.getMaxOccurs());
                metainfHolder.addMinOccurs(choiceQName, xmlSchemaChoice.getMinOccurs());
                metainfHolder.setHasParticleType(true);

                if (order) {
                    //record the order in the metainf holder for the any
                    metainfHolder.registerQNameIndex(choiceQName,
View Full Code Here

            }

        } else if (item instanceof XmlSchemaChoice) {
            // we have to process many sequence types

            XmlSchemaChoice xmlSchemaChoice = (XmlSchemaChoice) item;
            if (xmlSchemaChoice.getItems().size() > 0) {
                BeanWriterMetaInfoHolder beanWriterMetaInfoHolder = new BeanWriterMetaInfoHolder();
                beanWriterMetaInfoHolder.setChoice(true);
                processChoiceItems(parentElementQName, xmlSchemaChoice.getItems(),
                                   beanWriterMetaInfoHolder, false, parentSchema);
                beanWriterMetaInfoHolder.setParticleClass(true);
                String localName = parentElementQName.getLocalPart() + "Choice";
                QName choiceQName = new QName(parentElementQName.getNamespaceURI(),
                                              localName + getNextTypeSuffix(localName));
                String javaClassName = writeComplexParticle(choiceQName, beanWriterMetaInfoHolder);
                processedTypemap.put(choiceQName, javaClassName);

                //put the partical to array
                Boolean isArray = xmlSchemaChoice.getMaxOccurs() > 1 ? Boolean.TRUE : Boolean.FALSE;
                processedElementArrayStatusMap.put(item, isArray);
                particleQNameMap.put(item, choiceQName);

                if (order) {
                    elementOrderMap.put(item, new Integer(sequenceCounter));
View Full Code Here

TOP

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

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.