Package org.apache.ws.commons.schema

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


                    // an Endpoint
                    // reference type.

                    if (schemaType == null
                            && xmlSchemaType.getIncludes().getCount() > 0) {
                        XmlSchemaObjectCollection includes = xmlSchemaType
                                .getIncludes();
                        Iterator includeIter = includes.getIterator();
                        while (includeIter.hasNext()) {
                            Object obj = includeIter.next();
                            if (!(obj instanceof XmlSchemaImport)) {
                                continue;
                            }
View Full Code Here


                                               List<CorbaTypeMap> typeMaps,
                                               ServiceInfo serviceInfo) {
        Struct structType = (Struct)obj.getType();
        List<MemberType> structMembers = structType.getMember();

        XmlSchemaObjectCollection attrs = null;
        XmlSchemaObjectCollection members = null;
           
        XmlSchemaObject stype = schemaType;
        QName qname = name;
        if (schemaType instanceof XmlSchemaElement) {
            XmlSchemaElement el = (XmlSchemaElement) schemaType;
            if (el.getQName() != null) {
                qname = el.getQName();
            }
            stype = el.getSchemaType();
            if (stype == null) {
                stype = CorbaUtils.getXmlSchemaType(serviceInfo, el.getRefName());
            }
        }
        if (stype instanceof XmlSchemaComplexType) {
            XmlSchemaComplexType ctype = (XmlSchemaComplexType) stype;
            if (ctype.getQName() != null) {
                qname = ctype.getQName();
            }
            attrs = ctype.getAttributes();
            stype = ctype.getParticle();
        }
        if (stype instanceof XmlSchemaGroupRef) {
            members = ((XmlSchemaGroupRef) stype).getParticle().getItems();
        } else if (stype instanceof XmlSchemaGroupBase) {
            members = ((XmlSchemaGroupBase) stype).getItems();
        }
        String nsURI = getNamespaceURI(serviceInfo, qname);
        int attrCount = 0;
        int memberCount = 0;
        for (int i = 0; i < structMembers.size(); ++i) {
            XmlSchemaObject schemaObj;
            if ((attrs != null) && (attrCount != attrs.getCount())) {
                schemaObj = attrs.getItem(attrCount++);
            } else {
                schemaObj = members.getItem(memberCount++);
            }
            MemberType member = structMembers.get(i);
            QName memberName = new QName(nsURI, member.getName());
            QName memberType = member.getIdltype();
            CorbaObjectHandler memberObj = initializeObjectHandler(orb,
View Full Code Here

            throw new CorbaBindingException("Couldn't find xml schema object for : " + idlType);
        }        
        CorbaStructHandler obj = null;
        try {           
            Struct structType = (Struct) CorbaUtils.getCorbaType(idlType, typeMaps);
            XmlSchemaObjectCollection attrs = null;
            XmlSchemaObjectCollection members = null;
           
            boolean readElement = false;

            XmlSchemaObject stype = schemaType;
            if (schemaType instanceof XmlSchemaElement) {
                XmlSchemaElement el = (XmlSchemaElement) schemaType;
                stype = el.getSchemaType();
                if (stype == null) {
                    stype = CorbaUtils.getXmlSchemaType(serviceInfo, el.getRefName());
                }
                readElement = true;
            }
            if (stype instanceof XmlSchemaComplexType) {
                XmlSchemaComplexType ctype = (XmlSchemaComplexType) stype;
                attrs = ctype.getAttributes();
                stype = ctype.getParticle();
                readElement = true;
            }
            if (stype instanceof XmlSchemaGroupRef) {
                members = ((XmlSchemaGroupRef) stype).getParticle().getItems();
            } else if (stype instanceof XmlSchemaGroupBase) {
                members = ((XmlSchemaGroupBase) stype).getItems();
            }
            QName elName;
            if ((attrs != null) && (attrs.getCount() > 0)) {
                elName = reader.peek().asStartElement().getName();
            } else if (readElement) {
                elName = reader.nextEvent().asStartElement().getName();
            } else {
                elName = CorbaUtils.EMPTY_QNAME;
            }
            obj = new CorbaStructHandler(elName, idlType, tc, structType);

            List<MemberType> structMembers = structType.getMember();
            int attrCount = 0;
            int memberCount = 0;
            for (int i = 0; i < structMembers.size(); ++i) {
                XmlSchemaObject schemaObj;
                if ((attrs != null) && (attrCount < attrs.getCount())) {
                    schemaObj = attrs.getItem(attrCount++);
                } else {
                    schemaObj = members.getItem(memberCount++);
                }
                CorbaObjectHandler member = readObjectFromStax(reader,
                                                               structMembers.get(i).getIdltype(),
                                                               schemaObj,
                                                               true);
View Full Code Here

            throw new CorbaBindingException("Couldn't find xml schema object for : " + obj.getIdlType());
        }
        if (objName == null) {
            objName = obj.getName();
        }
        XmlSchemaObjectCollection attrs = null;
        XmlSchemaObjectCollection members = null;
           
        boolean writeElement = false;

        XmlSchemaObject stype = schemaType;
        if (schemaType instanceof XmlSchemaElement) {
            XmlSchemaElement el = (XmlSchemaElement) schemaType;
            stype = el.getSchemaType();
            if (stype == null) {
                stype = CorbaUtils.getXmlSchemaType(serviceInfo, el.getRefName());
            }
            writeElement = true;
        }
        if (stype instanceof XmlSchemaComplexType) {
            XmlSchemaComplexType ctype = (XmlSchemaComplexType) stype;
            attrs = ctype.getAttributes();
            stype = ctype.getParticle();
            writeElement = true;
        }
        if (stype instanceof XmlSchemaGroupRef) {
            members = ((XmlSchemaGroupRef) stype).getParticle().getItems();
        } else if (stype instanceof XmlSchemaGroupBase) {
            members = ((XmlSchemaGroupBase) stype).getItems();
        }
       
        if (writeElement) {
            StartElement startEl = factory.createStartElement(objName, null, null);
            writer.add(startEl);
        }
       
        CorbaStructHandler structHandler = (CorbaStructHandler)obj;
        List<CorbaObjectHandler> elements = structHandler.getMembers();
        int attrCount = 0;
        int memberCount = 0;
        for (Iterator<CorbaObjectHandler> elementsIter = elements.iterator(); elementsIter.hasNext();) {
            XmlSchemaObject schemaObj;
            if ((attrs != null) && (attrCount != attrs.getCount())) {
                schemaObj = attrs.getItem(attrCount++);
            } else {
                schemaObj = members.getItem(memberCount++);
            }
            writeObjectToStax(elementsIter.next(), schemaObj, writer, factory, true);
        }
        if (writeElement) {
            EndElement endEl = factory.createEndElement(objName, null);
View Full Code Here

            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);
                    // We also need to set the discriminator since this is the branch with the actual
                    // union value
                    CorbaObjectHandler discObj =
                        CorbaHandlerUtils.createTypeHandler(orb,
                                                            new QName("discriminator"),
                                                            unionType.getDiscriminator(),
                                                            typeMaps,
                                                            serviceInfo);
                    obj.setDiscriminator(discObj);
                   
                    // Determine the value of the discriminator. 
                    List<CaseType> branchCases = branch.getCase();
                    String discValue = null;
                    if (branchCases.size() != 0) {
                        // This represents a union case.  Set the discriminator based on the first
                        // label value associated with the branch (since we don't have this information)
                        // from the Stax representation of the Celtix object).
                        CaseType caseLabel = branchCases.get(0);
                        discValue = caseLabel.getLabel();
                    } else {
                        // This represents the default case.
                        discValue = obj.createDefaultDiscriminatorLabel();
                    }
                    obj.setDiscriminatorValueFromData(discValue);
                    obj.setValue(branchName, branchObj);
                } else {
                    XmlSchemaElement el = (XmlSchemaElement) items.getItem(i);
                    QName qname = new QName("", branch.getName());
                    if (CorbaUtils.isElementFormQualified(serviceInfo, el.getQName().getNamespaceURI())) {
                        qname = el.getQName();
                    }
                    // Create an object holder with no value
View Full Code Here

        }
        return false;
    }

    private boolean isReferenceSchemaTypeDefined(QName objectReferenceName) {
        XmlSchemaObjectCollection schemaObjects = schema.getItems();

        for (Iterator iter = schemaObjects.getIterator(); iter.hasNext();) {
            java.lang.Object schemaObj = iter.next();
           
            if (schemaObj instanceof XmlSchemaElement) {
                XmlSchemaElement el = (XmlSchemaElement)schemaObj;
               
View Full Code Here

    }
   
    private XmlSchemaParticle getBuriedElement(XmlSchemaComplexType type,
                                              QName parentName) {
        XmlSchemaSequence sequence = getTypeSequence(type, parentName);
        XmlSchemaObjectCollection insides = sequence.getItems();
        if (insides.getCount() == 1) {
            XmlSchemaObject item = insides.getItem(0);
            if (item instanceof XmlSchemaElement || item instanceof XmlSchemaAny) {
                return (XmlSchemaParticle) item;
            }
        }
        return null;
View Full Code Here

        restriction.setBaseTypeName(XmlSchemaConstants.STRING_QNAME);
        simple.setContent(restriction);

        Object[] constants = getTypeClass().getEnumConstants();

        XmlSchemaObjectCollection facets = restriction.getFacets();
        for (Object constant : constants) {
            XmlSchemaEnumerationFacet f = new XmlSchemaEnumerationFacet();
            f.setValue(((Enum)constant).name());
            facets.add(f);
        }
    }
View Full Code Here

    private static boolean isWrappableSequence(XmlSchemaComplexType type, String namespaceURI,
                                               MessageInfo wrapper, boolean allowRefs) {
        if (type.getParticle() instanceof XmlSchemaSequence) {
            XmlSchemaSequence seq = (XmlSchemaSequence)type.getParticle();
            XmlSchemaObjectCollection items = seq.getItems();
            boolean ret = true;
            for (int x = 0; x < items.getCount(); x++) {
                XmlSchemaObject o = items.getItem(x);
                if (!(o instanceof XmlSchemaElement)) {
                    return false;
                }
                XmlSchemaElement el = (XmlSchemaElement)o;
View Full Code Here

        XmlSchemaSequence seq = (XmlSchemaSequence)type.getParticle();
      
        if (seq != null) {

            XmlSchemaObjectCollection items = seq.getItems();

            Iterator ite = items.getIterator();

            while (ite.hasNext()) {
                XmlSchemaElement subElement = (XmlSchemaElement)ite.next();

                if (subElement.getQName() != null) {
View Full Code Here

TOP

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

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.