Package org.apache.ws.commons.schema

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


        // each item is checked if it is a duplicate entry and copied only if it isn't
        Iterator itemsIterator = aSchema.getItems().getIterator();
        Object schemaObject = null;
        XmlSchemaElement schemaElement = null;
        XmlSchemaType schemaType = null;
        XmlSchemaInclude schemaInclude = null;
        QName qName = null;
        List existingIncludes = getExistingIncludes(existingSchema);

        while (itemsIterator.hasNext()) {
            schemaObject = itemsIterator.next();
            if (schemaObject instanceof XmlSchemaElement) {
                schemaElement = (XmlSchemaElement) schemaObject;
                qName = schemaElement.getQName();
                // if the element does not exist in the existing schema
                if (existingSchema.getElementByName(qName) == null) {
                    // add it to the existing schema
                    existingSchema.getElements().add(qName,
                                                     schemaElement);
                    existingSchema.getItems().add(schemaElement);
                }
            } else if (schemaObject instanceof XmlSchemaType) {
                schemaType = (XmlSchemaType) itemsIterator.next();
                qName = schemaType.getQName();
                // if the element does not exist in the existing schema
                if (existingSchema.getElementByName(qName) == null) {
                    // add it to the existing schema
                    existingSchema.getSchemaTypes().add(qName,
                                                        schemaType);
                    existingSchema.getItems().add(schemaType);
                    // add imports
                    addImports(existingSchema,
                               qName);
                }
            } else if (schemaObject instanceof XmlSchemaInclude) {
                schemaInclude = (XmlSchemaInclude) itemsIterator.next();
                if (!existingIncludes.contains(schemaInclude.getSchemaLocation())) {
                    existingSchema.getIncludes().add(schemaInclude);
                    existingSchema.getItems().add(schemaInclude);
                }
            }
        }
View Full Code Here


                String schemaLocation = null;
                if ((schemaLocation = (String) schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null) {
                    schemaLocation = DEFAULT_SCHEMA_LOCATION;
                }

                XmlSchemaInclude includeElement = new XmlSchemaInclude();
                includeElement.setSchemaLocation(schemaLocation);

                if (!xmlSchema.getIncludes().contains(includeElement)) {
                    xmlSchema.getIncludes().add(includeElement);
                }
            }
View Full Code Here

        for (XmlSchema d : schemaCollection.getXmlSchemas()) {
            if (ns.equals(d.getTargetNamespace())) {
                if (d == facade) {
                    continue;
                }
                XmlSchemaInclude include = new XmlSchemaInclude();
                include.setSchema(d);
                include.setSourceURI(d.getSourceURI());
                include.setSchemaLocation(d.getSourceURI());
                facade.getIncludes().add(include);
                facade.getItems().add(include);
            }
        }
        aggregated.setUnresolved(true);
View Full Code Here

        for (XmlSchema d : schemaCollection.getXmlSchemas()) {
            if (ns.equals(d.getTargetNamespace())) {
                if (d == facade) {
                    continue;
                }
                XmlSchemaInclude include = new XmlSchemaInclude();
                include.setSchema(d);
                include.setSourceURI(d.getSourceURI());
                include.setSchemaLocation(d.getSourceURI());
                facade.getIncludes().add(include);
                facade.getItems().add(include);
            }
        }
        aggregated.setUnresolved(true);
View Full Code Here

        Set set = new HashSet();
        set.add(Resources.asURI("include2.xsd"));
        set.add(Resources.asURI("include3.xsd"));
        for (int i = 0; i < c.getCount(); i++) {
            XmlSchemaInclude include = (XmlSchemaInclude)c.getItem(i);
            assertNotNull(include);
            XmlSchema s = include.getSchema();
            assertNotNull(s);
            String schemaLocation = include.getSchemaLocation();
            if (schemaLocation.equals(Resources.asURI("include2.xsd"))) {
                XmlSchemaElement xse =
                    s.getElementByName(new
                        QName("http://soapinterop.org/types", "test1include"));
                assertEquals("test1include", xse.getName());
View Full Code Here

        Set<String> set = new HashSet<String>();
        set.add(Resources.asURI("include2.xsd"));
        set.add(Resources.asURI("include3.xsd"));
        for (int i = 0; i < c.size(); i++) {
            XmlSchemaInclude include = (XmlSchemaInclude)c.get(i);
            assertNotNull(include);
            XmlSchema s = include.getSchema();
            assertNotNull(s);
            String schemaLocation = include.getSchemaLocation();
            if (schemaLocation.equals(Resources.asURI("include2.xsd"))) {
                XmlSchemaElement xse = s.getElementByName(new QName("http://soapinterop.org/types",
                                                                    "test1include"));
                assertEquals("test1include", xse.getName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
View Full Code Here

        XmlSchema schema = schemaCol.read(is);

        List<XmlSchemaExternal> c = schema.getExternals();
        assertEquals(1, c.size());

        XmlSchemaInclude schemaInclude = (XmlSchemaInclude)c.get(0);
        assertNotNull(schemaInclude);

        XmlSchema schema2 = schemaInclude.getSchema();
        assertNull(schema2.getTargetNamespace());
    }
View Full Code Here

        for (XmlSchema d : schemaCollection.getXmlSchemas()) {
            if (ns.equals(d.getTargetNamespace())) {
                if (d == facade) {
                    continue;
                }
                XmlSchemaInclude include = new XmlSchemaInclude();
                include.setSchema(d);
                include.setSourceURI(d.getSourceURI());
                include.setSchemaLocation(d.getSourceURI());
                facade.getIncludes().add(include);
                facade.getItems().add(include);
            }
        }
        aggregated.setUnresolved(true);
View Full Code Here

TOP

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

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.