Package org.apache.ws.commons.schema

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


        XmlSchemaComplexType xsct = (XmlSchemaComplexType)elem.getSchemaType();
        assertNotNull(xsct);
        XmlSchemaSimpleContent xssc = (XmlSchemaSimpleContent)xsct.getContentModel();
        assertNotNull(xssc);
       
        XmlSchemaSimpleContentExtension xssce
            = (XmlSchemaSimpleContentExtension)xssc.getContent();
        assertNotNull(xssce);
        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"),
                     xssce.getBaseTypeName());

        XmlSchemaObjectCollection xsoc = xssce.getAttributes();
        assertEquals(3, xsoc.getCount());

        Set s = new HashSet();
        s.add("units");
        s.add("id");
View Full Code Here


        XmlSchemaType base = null;       
        List attrMembers = null;
        CorbaTypeImpl basetype = null;

        if (simpleContent.getContent() instanceof XmlSchemaSimpleContentExtension) {       
            XmlSchemaSimpleContentExtension ext =
                (XmlSchemaSimpleContentExtension)simpleContent.getContent();
                       
            if (ext.getBaseTypeName() != null) {
                basetype = processPrimitiveType(ext.getBaseTypeName());
            }
           
            // process  ext types ????                     
            MemberType basemember = new MemberType();
            basemember.setName("_simpleTypeValue");
            basemember.setIdltype(basetype.getType());
            corbaStruct.getMember().add(basemember);
            attrMembers = processAttributesAsMembers(ext.getAttributes().getIterator());
        } else if (simpleContent.getContent() instanceof XmlSchemaSimpleContentRestriction) {
            XmlSchemaSimpleContentRestriction restrict
                = (XmlSchemaSimpleContentRestriction)simpleContent.getContent();
            basetype = convertSchemaToCorbaType(base, base.getQName(), base, false);
            base = restrict.getBaseType();
View Full Code Here

    private void processSimpleContent(XmlSchemaSimpleContent simpleContent, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema)
            throws SchemaCompilationException {
        XmlSchemaContent content;
        content = simpleContent.getContent();
        if (content instanceof XmlSchemaSimpleContentExtension) {
            XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content;

            //process the base type if it has not been processed yet
            if (!isAlreadyProcessed(extension.getBaseTypeName())) {
                //pick the relevant basetype from the schema and process it
                XmlSchema resolvedSchema = getParentSchema(parentSchema, extension.getBaseTypeName(), COMPONENT_TYPE);
                if (resolvedSchema == null) {
                    throw new SchemaCompilationException("can not find type " + extension.getBaseTypeName()
                            + " from the parent schema " + parentSchema.getTargetNamespace());
                } else {
                    XmlSchemaType type = resolvedSchema.getTypeByName(extension.getBaseTypeName());
                    if (type instanceof XmlSchemaComplexType) {
                        XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
                        if (complexType.getName() != null) {
                            processNamedComplexSchemaType(complexType, resolvedSchema);
                        } else {
                            //this is not possible. The extension should always
                            //have a name
                            throw new SchemaCompilationException("Unnamed complex type used in extension");//Internationlize this
                        }
                    } else if (type instanceof XmlSchemaSimpleType) {
                        //process simple type
                        processSimpleSchemaType((XmlSchemaSimpleType) type, null, resolvedSchema, null);
                    }
                }

            }

            //process extension base type
            processSimpleExtensionBaseType(extension.getBaseTypeName(), metaInfHolder, parentSchema);

            //process attributes
            XmlSchemaObjectCollection attribs = extension.getAttributes();
            Iterator attribIterator = attribs.getIterator();
            while (attribIterator.hasNext()) {
                Object attr = attribIterator.next();
                if (attr instanceof XmlSchemaAttribute) {
                    processAttribute((XmlSchemaAttribute) attr, metaInfHolder, parentSchema);

                }
            }

            //process any attribute
            XmlSchemaAnyAttribute anyAtt = extension.getAnyAttribute();
            if (anyAtt != null) {
                processAnyAttribute(metaInfHolder, anyAtt);
            }

        } else if (content instanceof XmlSchemaSimpleContentRestriction) {
View Full Code Here

        } else {
            uri = defaultName.getNamespaceURI();
        }

        if (simpleContent.getContent() instanceof XmlSchemaSimpleContentExtension) {
            XmlSchemaSimpleContentExtension ext =
                (XmlSchemaSimpleContentExtension)simpleContent.getContent();

            if (ext.getBaseTypeName() != null) {
                basetype = processPrimitiveType(ext.getBaseTypeName());
            }

            if (basetype == null) {
                base = getSchemaType(ext.getBaseTypeName());
                basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
            }
            if (basetype == null) {
                return null;
            }
            // process  ext types ????
            MemberType basemember = new MemberType();
            basemember.setName("_simpleTypeValue");
            QName baseTypeName = checkPrefix(basetype.getQName());
            basemember.setIdltype(baseTypeName);
            corbaStruct.getMember().add(basemember);
            if (!isDuplicate(basetype)) {
                typeMappingType.getStructOrExceptionOrUnion().add(basetype);
            }
            attrMembers = processAttributesAsMembers(ext.getAttributes(), uri);
        } else if (simpleContent.getContent() instanceof XmlSchemaSimpleContentRestriction) {
            XmlSchemaSimpleContentRestriction restrict
                = (XmlSchemaSimpleContentRestriction)simpleContent.getContent();

            base = restrict.getBaseType();
View Full Code Here

        } 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

    private void processSimpleContent(XmlSchemaSimpleContent simpleContent,BeanWriterMetaInfoHolder metaInfHolder,XmlSchema parentSchema)
            throws SchemaCompilationException{
        XmlSchemaContent content;
        content = simpleContent.getContent();
        if (content instanceof XmlSchemaSimpleContentExtension){
          XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension)content;

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

          //process extension base type
          processSimpleExtensionBaseType(extension.getBaseTypeName(),metaInfHolder);

          //process attributes
            XmlSchemaObjectCollection attribs = extension.getAttributes();
            Iterator attribIterator = attribs.getIterator();
            while (attribIterator.hasNext()) {
                Object attr = attribIterator.next();
                if (attr instanceof XmlSchemaAttribute) {
                    processAttribute((XmlSchemaAttribute) attr, metaInfHolder,parentSchema);

                }
            }

            //process any attribute
            XmlSchemaAnyAttribute anyAtt = extension.getAnyAttribute();
            if (anyAtt != null) {
                processAnyAttribute(metaInfHolder,anyAtt);
            }

        }else if (content instanceof XmlSchemaSimpleContentRestriction){
View Full Code Here

        } else {
            uri = defaultName.getNamespaceURI();
        }

        if (simpleContent.getContent() instanceof XmlSchemaSimpleContentExtension) {       
            XmlSchemaSimpleContentExtension ext =
                (XmlSchemaSimpleContentExtension)simpleContent.getContent();
                       
            if (ext.getBaseTypeName() != null) {
                basetype = processPrimitiveType(ext.getBaseTypeName());
            }
           
            if (basetype == null) {
                base = getSchemaType(ext.getBaseTypeName());
                basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
            }
            if (basetype == null) {
                return null;
            }           
            // process  ext types ????                     
            MemberType basemember = new MemberType();
            basemember.setName("_simpleTypeValue");
            QName baseTypeName = checkPrefix(basetype.getQName());
            basemember.setIdltype(baseTypeName);
            corbaStruct.getMember().add(basemember);
            if (!isDuplicate(basetype)) {
                typeMappingType.getStructOrExceptionOrUnion().add(basetype);
            }
            attrMembers = processAttributesAsMembers(ext.getAttributes().getIterator(), uri);
        } else if (simpleContent.getContent() instanceof XmlSchemaSimpleContentRestriction) {
            XmlSchemaSimpleContentRestriction restrict
                = (XmlSchemaSimpleContentRestriction)simpleContent.getContent();
                       
            base = restrict.getBaseType();
View Full Code Here

        if (type instanceof XmlSchemaComplexType) {
            XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
            if (complexType.getContentModel() instanceof XmlSchemaSimpleContent) {
                XmlSchemaSimpleContent content = (XmlSchemaSimpleContent)complexType.getContentModel();
                if (content.getContent() instanceof XmlSchemaSimpleContentExtension) {
                    XmlSchemaSimpleContentExtension extension =
                        (XmlSchemaSimpleContentExtension)content.getContent();
                    if (XmlSchemaConstants.BASE64BINARY_QNAME.equals(extension.getBaseTypeName())) {
                        return true;
                    }
                }
            }
        }
View Full Code Here

    private void processSimpleContent(XmlSchemaSimpleContent simpleContent, BeanWriterMetaInfoHolder metaInfHolder, XmlSchema parentSchema)
            throws SchemaCompilationException {
        XmlSchemaContent content;
        content = simpleContent.getContent();
        if (content instanceof XmlSchemaSimpleContentExtension) {
            XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content;

            //process the base type if it has not been processed yet
            if (!isAlreadyProcessed(extension.getBaseTypeName())) {
                //pick the relevant basetype from the schema and process it
                XmlSchema resolvedSchema = getParentSchema(parentSchema, extension.getBaseTypeName(), COMPONENT_TYPE);
                if (resolvedSchema == null) {
                    throw new SchemaCompilationException("can not find type " + extension.getBaseTypeName()
                            + " from the parent schema " + parentSchema.getTargetNamespace());
                } else {
                    XmlSchemaType type = resolvedSchema.getTypeByName(extension.getBaseTypeName());
                    if (type instanceof XmlSchemaComplexType) {
                        XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
                        if (complexType.getName() != null) {
                            processNamedComplexSchemaType(complexType, resolvedSchema);
                        } else {
                            //this is not possible. The extension should always
                            //have a name
                            throw new SchemaCompilationException("Unnamed complex type used in extension");//Internationlize this
                        }
                    } else if (type instanceof XmlSchemaSimpleType) {
                        //process simple type
                        processSimpleSchemaType((XmlSchemaSimpleType) type, null, resolvedSchema, null);
                    }
                }

            }

            //process extension base type
            processSimpleExtensionBaseType(extension.getBaseTypeName(), metaInfHolder, parentSchema);

            //process attributes
            XmlSchemaObjectCollection attribs = extension.getAttributes();
            Iterator attribIterator = attribs.getIterator();
            while (attribIterator.hasNext()) {
                Object attr = attribIterator.next();
                if (attr instanceof XmlSchemaAttribute) {
                    processAttribute((XmlSchemaAttribute) attr, metaInfHolder, parentSchema);

                }
            }

            //process any attribute
            XmlSchemaAnyAttribute anyAtt = extension.getAnyAttribute();
            if (anyAtt != null) {
                processAnyAttribute(metaInfHolder, anyAtt);
            }

        } else if (content instanceof XmlSchemaSimpleContentRestriction) {
View Full Code Here

        }
        XmlSchemaSimpleType type = new XmlSchemaSimpleType(root);
        type.setName(getSchemaType().getLocalPart());
        root.getItems().add(type);
        root.addType(type);
        XmlSchemaSimpleContentExtension ext = new XmlSchemaSimpleContentExtension();
        ext.setBaseTypeName(XmlSchemaConstants.STRING_QNAME);
        XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction();
        content.setBaseTypeName(XmlSchemaConstants.STRING_QNAME);
        type.setContent(content);
    }
View Full Code Here

TOP

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

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.