Package org.apache.ws.commons.schema

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


        boolean bigByteOk = false;

        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("littleByte".equals(oe.getName())) {
                    littleByteOk = true;
                    assertNotNull(oe.getSchemaTypeName());
                    assertEquals(XmlSchemaConstants.BYTE_QNAME, oe.getSchemaTypeName());
                } else if ("bigByte".equals(oe.getName())) {
                    bigByteOk = true;
                    assertNotNull(oe.getSchemaTypeName());
                    assertEquals(XmlSchemaConstants.BYTE_QNAME, oe.getSchemaTypeName());
                }
            }
        }
        assertTrue(littleByteOk);
        assertTrue(bigByteOk);
View Full Code Here


        }
    }

    private boolean needToRender(MessagePartInfo part) {
        if (part != null && part.getXmlSchema() instanceof XmlSchemaElement) {
            XmlSchemaElement element = (XmlSchemaElement)part.getXmlSchema();
            return element.isNillable() && element.getMinOccurs() > 0;
        }
        return false;
    }
View Full Code Here

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

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

        seq.getItems().add(element);

        if (componentType.isNillable()) {
            element.setNillable(true);
        }

        element.setMinOccurs(getMinOccurs());
        element.setMaxOccurs(getMaxOccurs());

    }
View Full Code Here

        boolean bleh = false;

        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement a = (XmlSchemaElement)o;
                if ("bleh".equals(a.getName())) {
                    bleh = true;
                }
            }
        }

        for (int x = 0; x < stype.getAttributes().size(); x++) {
            XmlSchemaObject o = stype.getAttributes().get(x);
            if (o instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute a = (XmlSchemaAttribute)o;
                if ("howdy".equals(a.getName())) {
                    howdy = true;
                }
            }
        }
View Full Code Here

        boolean int1ok = false;
        boolean int2ok = false;
        for (int x = 0; x < seq.getItems().size(); x++) {
            XmlSchemaSequenceMember o = seq.getItems().get(x);
            if (o instanceof XmlSchemaElement) {
                XmlSchemaElement oe = (XmlSchemaElement) o;
                if ("int1".equals(oe.getName())) {
                    int1ok = true;
                    assertTrue(oe.isNillable());
                    assertEquals(0, oe.getMinOccurs());
                } else if ("int2".equals(oe.getName())) {
                    int2ok = true;
                    assertEquals(0, oe.getMinOccurs());
                    assertFalse(oe.isNillable());
                }
            }
        }
        assertTrue(int1ok);
        assertTrue(int2ok);
View Full Code Here

            if (namespace == null) {
                namespace = defaultNamespace;
            }
        }
        final QName qname = new QName(namespace, name + postfix);
        final XmlSchemaElement el = schemas.getElementByQName(qname);
        XmlSchemaType type = null;
        if (el != null) {
            type = el.getSchemaType();
        }
        if (type == null) {
            type = schemas.getTypeByQName(getTypeQName(origCls, namespace));
            if (type == null) {
                type = schemas.getTypeByQName(qname);
View Full Code Here

            for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
                XmlSchemaObjectTable elementsTable = schemaInfo.getSchema().getElements();
                Iterator elementsIterator = elementsTable.getNames();
                while (elementsIterator.hasNext()) {
                    QName elementName = (QName)elementsIterator.next();
                    XmlSchemaElement element = schemaInfo.getSchema().getElementByName(elementName);
                    if (element.getSchemaType() == null) {
                        QName typeName = element.getSchemaTypeName();
                        if (typeName != null) {
                            XmlSchemaType type = schemaCollection.getTypeByQName(typeName);
                            if (type == null) {
                                Message message = new Message("REFERENCE_TO_UNDEFINED_TYPE", LOG, element
                                    .getQName(), typeName, service.getName());
                                LOG.severe(message.toString());
                            } else {
                                element.setSchemaType(type);
                            }
                        }
                    }
                }
View Full Code Here

            if (op.getUnwrappedOperation() != null) {
                if (op.hasInput()) {
                    if (op.getInput().getMessageParts().get(0).getTypeClass() == null) {

                        QName wrapperBeanName = op.getInput().getMessageParts().get(0).getElementQName();
                        XmlSchemaElement e = null;
                        for (SchemaInfo s : serviceInfo.getSchemas()) {
                            e = s.getElementByQName(wrapperBeanName);
                            if (e != null) {
                                op.getInput().getMessageParts().get(0).setXmlSchema(e);
                                break;
                            }
                        }
                        if (e == null) {
                            createWrappedSchema(serviceInfo, op.getInput(), op.getUnwrappedOperation()
                                .getInput(), wrapperBeanName);
                        }
                    }

                    for (MessagePartInfo mpi : op.getInput().getMessageParts()) {
                        if (Boolean.TRUE.equals(mpi.getProperty(HEADER))) {
                            QName qn = (QName)mpi.getProperty(ELEMENT_NAME);
                            mpi.setElement(true);
                            mpi.setElementQName(qn);

                            checkForElement(serviceInfo, mpi);
                        }
                    }

                }
                if (op.hasOutput()) {
                    if (op.getOutput().getMessageParts().get(0).getTypeClass() == null) {

                        QName wrapperBeanName = op.getOutput().getMessageParts().get(0).getElementQName();
                        XmlSchemaElement e = null;
                        for (SchemaInfo s : serviceInfo.getSchemas()) {
                            e = s.getElementByQName(wrapperBeanName);
                            if (e != null) {
                                break;
                            }
View Full Code Here

    }

    protected void checkForElement(ServiceInfo serviceInfo, MessagePartInfo mpi) {
        for (SchemaInfo s : serviceInfo.getSchemas()) {
            XmlSchemaElement e = s.getElementByQName(mpi.getElementQName());
            if (e != null) {
                mpi.setXmlSchema(e);
                return;
            }
        }
        SchemaInfo si = getOrCreateSchema(serviceInfo, mpi.getElementQName().getNamespaceURI(),
                                          getQualifyWrapperSchema());
        XmlSchema schema = si.getSchema();

        XmlSchemaElement el = new XmlSchemaElement();
        XmlSchemaTools.setElementQName(el, mpi.getElementQName());
        if (!isExistSchemaElement(schema, mpi.getElementQName())) {
            SchemaCollection.addGlobalElementToSchema(schema, el);
        }

        el.setNillable(true);

        XmlSchemaType tp = (XmlSchemaType)mpi.getXmlSchema();
        if (tp == null) {
            throw new ServiceConstructionException(new Message("INTRACTABLE_PART", LOG,
                                                               mpi.getName(),
                                                               mpi.getMessageInfo().getName()));
        }
        el.setSchemaTypeName(tp.getQName());
        mpi.setXmlSchema(el);
    }
View Full Code Here

                    paraNumber++;
                    continue;
                }
            }

            XmlSchemaElement el = new XmlSchemaElement();
            XmlSchemaTools.setElementQName(el, qname);
            el.setNillable(true);

            if (!isExistSchemaElement(schema, qname)) {
                SchemaCollection.addGlobalElementToSchema(schema, el);
            } else {
                el = getExistingSchemaElement(schema, qname);
            }

            if (mpi.isElement()) {
                XmlSchemaElement oldEl = (XmlSchemaElement)mpi.getXmlSchema();
                if (null != oldEl && !oldEl.getQName().equals(qname)) {
                    el.setSchemaTypeName(oldEl.getSchemaTypeName());
                    el.setSchemaType(oldEl.getSchemaType());
                    if (oldEl.getSchemaTypeName() != null) {
                        addImport(schema, oldEl.getSchemaTypeName().getNamespaceURI());
                    }
                }
                mpi.setElement(true);
                mpi.setXmlSchema(el);
                mpi.setElementQName(qname);
View Full Code Here

TOP

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

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.