Package org.apache.ws.commons.schema

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


                                        extension.getBaseTypeName(),
                                        resolvedSchema);

                            } else if (complexContent.getContent() instanceof XmlSchemaComplexContentRestriction) {

                                XmlSchemaComplexContentRestriction restriction =
                                        (XmlSchemaComplexContentRestriction) complexContent.getContent();
                                //recursively call the copyMetaInfoHierarchy method
                                copyMetaInfoHierarchy(baseMetaInfoHolder,
                                        restriction.getBaseTypeName(),
                                        resolvedSchema);

                            } else {
                                throw new SchemaCompilationException(
                                        SchemaCompilerMessages.getMessage("schema.unknowncontenterror"));
View Full Code Here


            QName extName = extype.getBaseTypeName();
            corbaStruct = processComplexContentStructParticle(extype.getParticle(), defaultName, corbaStruct,
                                                         schematypeName, extName, extype.getAttributes());
        } else {
            if (complex.getContent() instanceof XmlSchemaComplexContentRestriction) {
                XmlSchemaComplexContentRestriction extype
                    = (XmlSchemaComplexContentRestriction)complex.getContent();
                QName extName = extype.getBaseTypeName();
                corbaStruct =
                    processComplexContentStructParticle(extype.getParticle(), defaultName,
                                                   corbaStruct, schematypeName,
                                                   extName, extype.getAttributes());
            }
        }
        return corbaStruct;
    }
View Full Code Here

            XmlSchemaParticle particle = extension.getParticle();
            if (particle instanceof XmlSchemaSequence) {
                addCrossImportsSequence(schema, (XmlSchemaSequence)particle);
            }
        } else if (content instanceof XmlSchemaComplexContentRestriction) {
            XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction)content;
            XmlSchemaUtils.addImportIfNeeded(schema, restriction.getBaseTypeName());
            addCrossImportsAttributeList(schema, restriction.getAttributes());
        } else if (content instanceof XmlSchemaSimpleContentExtension) {
            XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension)content;
            XmlSchemaUtils.addImportIfNeeded(schema, extension.getBaseTypeName());
            addCrossImportsAttributeList(schema, extension.getAttributes());
        } else if (content instanceof XmlSchemaSimpleContentRestriction) {
            XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction)content;
            XmlSchemaUtils.addImportIfNeeded(schema, restriction.getBaseTypeName());
            addCrossImportsAttributeList(schema, restriction.getAttributes());
        }
    }
View Full Code Here

                metaInfHolder.setExtension(true);
                metaInfHolder.setExtensionClassName(className);
                //Note  - this is no array! so the array boolean is false
            }
        }else if (content instanceof XmlSchemaComplexContentRestriction){
          XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;

            //process the base type if it has not been processed yet
            if (!isAlreadyProcessed(restriction.getBaseTypeName())){
                //pick the relevant basetype from the schema and process it
                XmlSchemaType type = getType(parentSchema, restriction.getBaseTypeName());
                if (type instanceof XmlSchemaComplexType) {
                    XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
                    if (complexType.getName() != null) {
                        processNamedComplexSchemaType(complexType,parentSchema);
                    } else {
                        //this is not possible. The restriction should always
                        //have a name
                        throw new SchemaCompilationException("Unnamed complex type used in restriction");//Internationlize this
                    }
                } else if (type instanceof XmlSchemaSimpleType) {

                  throw new SchemaCompilationException("Not a valid restriction, complex content restriction base type cannot be a simple type.");
                }
            }

            copyMetaInfoHierarchy(metaInfHolder,restriction.getBaseTypeName(),parentSchema);

            //process the particle of this node
            processParticle(restriction.getParticle(),metaInfHolder,parentSchema);

             //process attributes - first look for the explicit attributes
            XmlSchemaObjectCollection attribs = restriction.getAttributes();
            Iterator attribIterator = attribs.getIterator();
            while (attribIterator.hasNext()) {
                Object o = attribIterator.next();
                if (o instanceof XmlSchemaAttribute) {
                    processAttribute((XmlSchemaAttribute) o, metaInfHolder,parentSchema);

                }
            }

            //process any attribute
            //somehow the xml schema parser does not seem to pickup the any attribute!!
            XmlSchemaAnyAttribute anyAtt = restriction.getAnyAttribute();
            if (anyAtt != null) {
                processAnyAttribute(metaInfHolder,anyAtt);
            }

            String className = findClassName(restriction.getBaseTypeName(), false);

            if (!SchemaCompiler.DEFAULT_CLASS_NAME.equals(className)) {
                metaInfHolder.setRestriction(true);
                metaInfHolder.setRestrictionClassName(findClassName(restriction.getBaseTypeName(), false));
                //Note  - this is no array! so the array boolean is false
            }
        }
    }
View Full Code Here

                                    extension.getBaseTypeName(),
                                    parentSchema);

                        }else  if (complexContent.getContent() instanceof XmlSchemaComplexContentRestriction){

                            XmlSchemaComplexContentRestriction restriction =
                                    (XmlSchemaComplexContentRestriction)complexContent.getContent();
                            //recursively call the copyMetaInfoHierarchy method
                            copyMetaInfoHierarchy(baseMetaInfoHolder,
                                    restriction.getBaseTypeName(),
                                    parentSchema);

                        }else{
                            throw new SchemaCompilationException(
                                    SchemaCompilerMessages.getMessage("schema.unknowncontenterror"));
View Full Code Here

        final XmlSchemaContent content = contentModel.getContent();
        if (!(content instanceof XmlSchemaComplexContentRestriction)) {
            return false;
        }

        final XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
        return SOAP_ARRAY.equals(restriction.getBaseTypeName());
    }
View Full Code Here

        // Soap arrays are based on complex content restriction
        if (!isSoapArray(complexType)) {
            return null;
        }

        final XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) complexType.getContentModel().getContent();

        //First, handle case that looks like this:
        // <complexType name="ArrayOfstring">
        //     <complexContent>
        //         <restriction base="soapenc:Array">
        //             <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
        //         </restriction>
        //     </complexContent>
        // </complexType>
        final XmlSchemaObjectCollection attributes = restriction.getAttributes();
        for (final Iterator iterator = attributes.getIterator(); iterator.hasNext(); ) {
            final Object item = iterator.next();
            if (item instanceof XmlSchemaAttribute) {
                final XmlSchemaAttribute attribute = (XmlSchemaAttribute) item;
                if (attribute.getRefName().equals(SOAP_ARRAY_TYPE)) {
                    for (final Attr attr : attribute.getUnhandledAttributes()) {
                        final QName attQName = new QName(attr.getNamespaceURI(), attr.getLocalName());
                        if (WSDL_ARRAY_TYPE.equals(attQName)) {
                            // value is a namespace prefixed xsd type
                            final String value = attr.getValue();

                            // extract local part
                            final int pos = value.lastIndexOf(":");
                            final QName componentType;
                            if (pos < 0) {
                                componentType = new QName("", value);
                            } else {
                                final String localPart = value.substring(pos + 1);

                                // resolve the namespace prefix
                                final String prefix = value.substring(0, pos);
                                final String namespace = getNamespaceForPrefix(prefix, attr.getOwnerElement());

                                componentType = new QName(namespace, localPart);
                            }
                            log.debug("determined component type from element type");
                            return componentType;
                        }
                    }
                }
            }
        }

        // If that didn't work, try to handle case like this:
        // <complexType name="ArrayOfstring1">
        //     <complexContent>
        //         <restriction base="soapenc:Array">
        //             <sequence>
        //                 <element name="string1" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        //             </sequence>
        //         </restriction>
        //     </complexContent>
        // </complexType>
        final XmlSchemaParticle particle = restriction.getParticle();
        if (particle instanceof XmlSchemaSequence) {
            final XmlSchemaSequence sequence = (XmlSchemaSequence) particle;
            if (sequence.getItems().getCount() != 1) {
                throw new IllegalArgumentException("more than one element inside array definition: " + complexType);
            }
View Full Code Here

            Iterator attrs = extype.getAttributes().getIterator();
            corbaStruct = processComplexContentStructParticle(extype.getParticle(), defaultName, corbaStruct,
                                                         schematypeName, extName, attrs);
        } else {
            if (complex.getContent() instanceof XmlSchemaComplexContentRestriction) {
                XmlSchemaComplexContentRestriction extype
                    = (XmlSchemaComplexContentRestriction)complex.getContent();
                QName extName = extype.getBaseTypeName();
                Iterator attrs = extype.getAttributes().getIterator();
                corbaStruct =
                    processComplexContentStructParticle(extype.getParticle(), defaultName,
                                                   corbaStruct, schematypeName,
                                                   extName, attrs);               
            }
        }
        return corbaStruct;
View Full Code Here

        XmlSchemaContent content = contentModel.getContent();
        if (!(content instanceof XmlSchemaComplexContentRestriction)) {
            return false;
        }

        XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
        return SOAP_ARRAY.equals(restriction.getBaseTypeName());
    }
View Full Code Here

        // Soap arrays are based on complex content restriction
        if (!isSoapArray(complexType)) {
            return null;
        }

        XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) complexType.getContentModel().getContent();

        //First, handle case that looks like this:
        // <complexType name="ArrayOfstring">
        //     <complexContent>
        //         <restriction base="soapenc:Array">
        //             <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
        //         </restriction>
        //     </complexContent>
        // </complexType>
        XmlSchemaObjectCollection attributes = restriction.getAttributes();
        for (Iterator iterator = attributes.getIterator(); iterator.hasNext();) {
            Object item = iterator.next();
            if (item instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute attribute = (XmlSchemaAttribute) item;
                if (attribute.getRefName().equals(SOAP_ARRAY_TYPE)) {
                    for (Attr attr : attribute.getUnhandledAttributes()) {
                        QName attQName = new QName(attr.getNamespaceURI(), attr.getLocalName());
                        if (WSDL_ARRAY_TYPE.equals(attQName)) {
                            // value is a namespace prefixed xsd type
                            String value = attr.getValue();

                            // extract local part
                            int pos = value.lastIndexOf(":");
                            QName componentType;
                            if (pos < 0) {
                                componentType = new QName("", value);
                            } else {
                                String localPart = value.substring(pos + 1);

                                // resolve the namespace prefix
                                String prefix = value.substring(0, pos);
                                String namespace = getNamespaceForPrefix(prefix, attr.getOwnerElement());

                                componentType = new QName(namespace, localPart);
                            }
                            log.debug("determined component type from element type");
                            return componentType;
                        }
                    }
                }
            }
        }

        // If that didn't work, try to handle case like this:
        // <complexType name="ArrayOfstring1">
        //     <complexContent>
        //         <restriction base="soapenc:Array">
        //             <sequence>
        //                 <element name="string1" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        //             </sequence>
        //         </restriction>
        //     </complexContent>
        // </complexType>
        XmlSchemaParticle particle = restriction.getParticle();
        if (particle instanceof XmlSchemaSequence) {
            XmlSchemaSequence sequence = (XmlSchemaSequence) particle;
            if (sequence.getItems().getCount() != 1) {
                throw new IllegalArgumentException("more than one element inside array definition: " + complexType);
            }
View Full Code Here

TOP

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

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.