Package org.apache.ws.commons.schema

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


        } 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


        } 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

            if (anyAtt != null) {
                processAnyAttribute(metaInfHolder,anyAtt);
            }
           
        }else if (content instanceof XmlSchemaSimpleContentRestriction){
          XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) 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 extension should always
                //have a name
                throw new SchemaCompilationException("Unnamed complex type used in restriction");//Internationlize this
              }
            } else if (type instanceof XmlSchemaSimpleType) {
              //process simple type
              processSimpleSchemaType((XmlSchemaSimpleType)type,null, parentSchema);
            }
          }
          //process restriction base type
          processSimpleRestrictionBaseType(restriction.getBaseTypeName(), restriction.getBaseTypeName(),metaInfHolder);
        }
    }
View Full Code Here

            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();

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

            if (basetype == null) {
                base = getSchemaType(restrict.getBaseTypeName());
                basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
            }

            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(restrict.getAttributes(), uri);
        }

        //Deal with Attributes defined in Extension
        if (attrMembers != null) {
            for (int i = 0; i < attrMembers.size(); i++) {
View Full Code Here

            if (anyAtt != null) {
                processAnyAttribute(metaInfHolder, anyAtt);
            }

        } else if (content instanceof XmlSchemaSimpleContentRestriction) {
            XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) 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
                XmlSchema resolvedSchema = getParentSchema(parentSchema, restriction.getBaseTypeName(), COMPONENT_TYPE);
                if (resolvedSchema == null) {
                    throw new SchemaCompilationException("can not find type " + restriction.getBaseTypeName()
                            + " from the parent schema " + parentSchema.getTargetNamespace());
                } else {
                    XmlSchemaType type = resolvedSchema.getTypeByName(restriction.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 restriction");//Internationlize this
                        }
                    } else if (type instanceof XmlSchemaSimpleType) {
                        //process simple type
                        processSimpleSchemaType((XmlSchemaSimpleType) type, null, resolvedSchema, null);
                    }
                }

            }
            //process restriction base type
            processSimpleRestrictionBaseType(restriction.getBaseTypeName(),
                    restriction.getBaseTypeName(),
                    metaInfHolder,
                    parentSchema);
            metaInfHolder.setSimple(true);
        }
    }
View Full Code Here

        } 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

        assertNotNull(xsct);

        XmlSchemaSimpleContent xssc = (XmlSchemaSimpleContent)xsct.getContentModel();
        assertNotNull(xssc);
       
        XmlSchemaSimpleContentRestriction xsscr
            = (XmlSchemaSimpleContentRestriction)xssc.getContent();
        assertNotNull(xsscr);
        assertEquals(new QName("http://soapinterop.org/types", "drinksize"),
                     xsscr.getBaseTypeName());
        XmlSchemaObjectCollection xsoc = xsscr.getAttributes();
        assertNotNull(xsoc);
        assertEquals(2, xsoc.getCount());

        Set s = new HashSet();
        s.add("units");
        s.add("id");
        for (int i = 0; i < xsoc.getCount(); i++) {
            XmlSchemaAttribute xsa = (XmlSchemaAttribute)xsoc.getItem(i);
            String name = xsa.getName();
            if (name.equals("units")) {
                assertEquals(new QName("http://soapinterop.org/types", "units"),
                             xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
                             xsa.getSchemaTypeName());
                assertNull(xsa.getDefaultValue());
                assertEquals("required", xsa.getUse().getValue());
                assertNull(xsa.getFixedValue());
            } else if (name.equals("id")) {
                assertEquals(new QName("http://soapinterop.org/types", "id"),
                             xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"),
                             xsa.getSchemaTypeName());
                assertEquals("001", xsa.getDefaultValue());
                assertEquals("required", xsa.getUse().getValue());
                assertNull(xsa.getFixedValue());
            } else {
                fail("The name \"" + name + "\" was not expected.");
            }
            assertTrue(s.remove(name));
        }
        assertTrue("The set should have been empty, but instead contained: "
                   + s + ".",
                   s.isEmpty());
       
        XmlSchemaObjectCollection xsoc2 = xsscr.getFacets();
        assertNotNull(xsoc2);
        assertEquals(2, xsoc2.getCount());

        s.clear();
        s.add("small");
View Full Code Here

        assertNotNull(xsct);

        XmlSchemaSimpleContent xssc = (XmlSchemaSimpleContent)xsct.getContentModel();
        assertNotNull(xssc);

        XmlSchemaSimpleContentRestriction xsscr = (XmlSchemaSimpleContentRestriction)xssc.getContent();
        assertNotNull(xsscr);
        assertEquals(new QName("http://soapinterop.org/types", "drinksize"), xsscr.getBaseTypeName());
        List<XmlSchemaAttributeOrGroupRef> xsoc = xsscr.getAttributes();
        assertNotNull(xsoc);
        assertEquals(2, xsoc.size());

        Set<String> s = new HashSet<String>();
        s.add("units");
        s.add("id");
        for (int i = 0; i < xsoc.size(); i++) {
            XmlSchemaAttribute xsa = (XmlSchemaAttribute)xsoc.get(i);
            String name = xsa.getName();
            if ("units".equals(name)) {
                assertEquals(new QName("http://soapinterop.org/types", "units"), xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
                             xsa.getSchemaTypeName());
                assertNull(xsa.getDefaultValue());
                assertEquals("required", xsa.getUse().toString());
                assertNull(xsa.getFixedValue());
            } else if ("id".equals(name)) {
                assertEquals(new QName("http://soapinterop.org/types", "id"), xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"), xsa
                    .getSchemaTypeName());
                assertEquals("001", xsa.getDefaultValue());
                assertEquals("required", xsa.getUse().toString());
                assertNull(xsa.getFixedValue());
            } else {
                fail("The name \"" + name + "\" was not expected.");
            }
            assertTrue(s.remove(name));
        }
        assertTrue("The set should have been empty, but instead contained: " + s + ".", s.isEmpty());

        List<XmlSchemaFacet> xsoc2 = xsscr.getFacets();
        assertNotNull(xsoc2);
        assertEquals(2, xsoc2.size());

        s.clear();
        s.add("small");
View Full Code Here

            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();

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

            if (basetype == null) {
                base = getSchemaType(restrict.getBaseTypeName());
                basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
            }

            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(restrict.getAttributes(), uri);
        }

        //Deal with Attributes defined in Extension
        for (int i = 0; i < attrMembers.size(); i++) {
            MemberType member = attrMembers.get(i);
View Full Code Here

            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();

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

            if (basetype == null) {
                base = getSchemaType(restrict.getBaseTypeName());
                basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
            }

            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(restrict.getAttributes(), uri);
        }

        //Deal with Attributes defined in Extension
        if (attrMembers != null) {
            for (int i = 0; i < attrMembers.size(); i++) {
View Full Code Here

TOP

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

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.