Package org.apache.ws.commons.schema

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


                XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
                restriction.setBaseTypeName(typeTable.getSimpleSchemaTypeName("java.lang.String"));
                simpleType.setContent(restriction);
                simpleType.setName(simpleName);

                XmlSchemaObjectCollection facets = restriction.getFacets();
                EnumType enumType = (EnumType) dataType;
                List enumMembers = enumType.getEnumMembers();
                for (int i = 0; i < enumMembers.size(); i++) {
                    facets.add(new XmlSchemaEnumerationFacet(enumMembers.get(i), false));
                }

                XmlSchemaElement eltOuter = new XmlSchemaElement();
                eltOuter.setName(simpleName);
                eltOuter.setQName(schemaTypeName);

                xmlSchema.getItems().add(eltOuter);
                xmlSchema.getElements().add(schemaTypeName, eltOuter);
                eltOuter.setSchemaTypeName(simpleType.getQName());

                xmlSchema.getItems().add(simpleType);
                xmlSchema.getSchemaTypes().add(schemaTypeName, simpleType);

                // adding this type to the table
                typeTable.addComplexSchema(name, eltOuter.getQName());
            } else if (dataType instanceof UnionType) {
                XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
                XmlSchemaChoice choice = new XmlSchemaChoice();
                XmlSchemaObjectCollection items = choice.getItems();

                UnionType unionType = (UnionType) dataType;
                Member[] members = unionType.getMembers();
                for (int i = 0; i < members.length; i++) {
                    items.add(generateSchemaforFieldsandProperties(xmlSchema, members[i].getDataType(),
                            members[i].getName(), true));
                }

                complexType.setParticle(choice);
                complexType.setName(simpleName);
View Full Code Here


        buildTypeDefinitions(schemaDef, schemaTns, typeSystemURI);
           
        //process elements and types declared in any included or imported schemas.
        //note that XmlSchema keeps included and imported schemas together, via getIncludes().
       
        XmlSchemaObjectCollection includeColl = schemaDef.getIncludes();
        Iterator includes = includeColl.getIterator();
        while(includes.hasNext()) {
            Object o = includes.next();
            XmlSchemaExternal externalSchema = (XmlSchemaExternal)o;
            XmlSchema schema = externalSchema.getSchema();
            if(schema != null )
View Full Code Here

            }
            if (!(particle instanceof XmlSchemaSequence)) {
                return null;
            }
            XmlSchemaSequence sequence = (XmlSchemaSequence)complexType.getParticle();
            XmlSchemaObjectCollection items = sequence.getItems();
            List<XmlSchemaElement> childElements = new ArrayList<XmlSchemaElement>();
            for (int i = 0; i < items.getCount(); i++) {
                XmlSchemaObject schemaObject = items.getItem(i);
                if (!(schemaObject instanceof XmlSchemaElement)) {
                    // Should contain elements only
                    return null;
                }
                XmlSchemaElement childElement = (XmlSchemaElement)schemaObject;
View Full Code Here

{
   Schema schema1 = fSchemas[0];
     XmlSchema xmlSchema = schema1.getSchemaDefinition();
     assertEquals("Unexpected targetNamespace.", "http://example.org/getAccountDetails/", schema1.getNamespace().toString());
    
     XmlSchemaObjectCollection schemaIncludes = xmlSchema.getIncludes(); // returns both includes and imports
   Iterator schemaIterator = schemaIncludes.getIterator();
   while (schemaIterator.hasNext())
   {
    XmlSchemaExternal xso = (XmlSchemaExternal) schemaIterator.next();
    if (xso instanceof XmlSchemaImport)
    {
View Full Code Here

{
   InlinedSchema schema1 = fInlinedSchemas[0];
   XmlSchema xmlSchema = schema1.getSchemaDefinition();
   assertEquals("Unexpected targetNamespace.", "http://example.org/getAccountDetails/", schema1.getNamespace().toString());
      
   XmlSchemaObjectCollection schemaIncludes = xmlSchema.getIncludes(); // returns both includes and imports
     Iterator schemaIterator = schemaIncludes.getIterator();
   while (schemaIterator.hasNext())
   {
    XmlSchemaExternal xso = (XmlSchemaExternal) schemaIterator.next();
    if (xso instanceof XmlSchemaInclude)
    {
View Full Code Here

{
   Schema schema1 = fSchemas[0];
     XmlSchema xmlSchema = schema1.getSchemaDefinition();
     assertEquals("Unexpected targetNamespace.", "http://example.org/getAccountDetails/", schema1.getNamespace().toString());
    
     XmlSchemaObjectCollection schemaIncludes = xmlSchema.getIncludes(); // returns both includes and imports
   Iterator schemaIterator = schemaIncludes.getIterator();
   while (schemaIterator.hasNext())
   {
    XmlSchemaExternal xso = (XmlSchemaExternal) schemaIterator.next();
    if (xso instanceof XmlSchemaImport)
    {
View Full Code Here

{
   InlinedSchema schema1 = fInlinedSchemas[0];
   XmlSchema xmlSchema = schema1.getSchemaDefinition();
   assertEquals("Unexpected targetNamespace.", "http://example.org/getAccountDetails/", schema1.getNamespace().toString());
      
   XmlSchemaObjectCollection schemaIncludes = xmlSchema.getIncludes(); // returns both includes and imports
     Iterator schemaIterator = schemaIncludes.getIterator();
   while (schemaIterator.hasNext())
   {
    XmlSchemaExternal xso = (XmlSchemaExternal) schemaIterator.next();
    if (xso instanceof XmlSchemaInclude)
    {
View Full Code Here

    }

       
    private static boolean buildMessageParts(XmlSchemaSequence seq, String namespaceURI, MessageInfo wrapper,
                                             boolean allowRefs) {    
        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

    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

        if (fromSchema == null || toSchema == null){
            return resultSchema;
        }
       
        // copy all the FROM items to the TO schema
        XmlSchemaObjectCollection fromItems = fromSchema.getItems();
        XmlSchemaObjectCollection toItems = toSchema.getItems();
        List<XmlSchemaObject> movedItems = new ArrayList<XmlSchemaObject>();
      
        Iterator<XmlSchemaObject> iter = fromItems.getIterator();
        while(iter.hasNext()){
            // don't copy import for TO namespace
            XmlSchemaObject obj = iter.next();
            if (obj instanceof XmlSchemaImport &&
                ((XmlSchemaImport)obj).getNamespace().equals(toNamespace)){
                // do nothing
            } else {
                toItems.add(obj);
                movedItems.add(obj);
            }
        }
       
        // check that all types in the TO namespace are now referred to correctly across the schema
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.