Package org.apache.ws.commons.schema

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


    private void addImport(XmlSchema schema, String ns) {
        if (!ns.equals(schema.getTargetNamespace())
            && !ns.equals(WSDLConstants.NS_SCHEMA_XSD)
            && !isExistImport(schema, ns)) {
            XmlSchemaImport is = new XmlSchemaImport();
            is.setNamespace(ns);
            if (this.schemaLocationMapping.get(ns) != null) {
                is.setSchemaLocation(this.schemaLocationMapping.get(ns));
            }
            schema.getItems().add(is);
        }
    }
View Full Code Here


        boolean isExist = false;

        for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
            XmlSchemaObject obj = (XmlSchemaObject)ite.next();
            if (obj instanceof XmlSchemaImport) {
                XmlSchemaImport xsImport = (XmlSchemaImport)obj;
                if (xsImport.getNamespace().equals(ns)) {
                    isExist = true;
                    break;
                }
            }
        }
View Full Code Here

        }

        for (XmlSchemaObject object : schema.getExternals()) {

            if (object instanceof XmlSchemaImport) {
                XmlSchemaImport schemaImport = (XmlSchemaImport) object;
                XmlSchema schema1 = schemaImport.getSchema();
                if (schema1 != null) {
                    compile(schema1, isPartofGroup);
                } else if (schemaImport.getNamespace().equals(Constants.NS_URI_XML)) {
                    // AXIS2-3229: some Web services (e.g. MS Exchange) assume that
                    // http://www.w3.org/XML/1998/namespace is a known namespace and that
                    // no schemaLocation is required when importing it. Load a local copy of
                    // the schema in that case.
                    schema1 = new XmlSchemaCollection().read(new InputSource(
                            SchemaCompiler.class.getResource("namespace.xsd").toExternalForm()));
                    schemaImport.setSchema(schema1);
                    compile(schema1, isPartofGroup);
                } else if (!schemaImport.getNamespace().equals(Constants.URI_2001_SCHEMA_XSD)) {
                    // Give the user a hint why the schema compilation fails...
                    log.warn("No schemaLocation for import of " + schemaImport.getNamespace() +
                             "; compilation may fail");
                }
            }
            if (object instanceof XmlSchemaInclude) {
                XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema();
View Full Code Here

                // if this is an inline import without a schema location
                // xmlschema does not load the schema.
                // so we try to figure out it either from the available schemas
                // or from the laded schemas.
                if ((externalSchema == null) && externalComponent instanceof XmlSchemaImport) {
                    XmlSchemaImport xmlSchemaImport = (XmlSchemaImport) externalComponent;
                    String importNamespce = xmlSchemaImport.getNamespace();
                    if ((importNamespce != null) && !importNamespce.
                            equals(Constants.URI_2001_SCHEMA_XSD)) {
                        if (loadedSchemaMap.containsKey(importNamespce)) {
                            externalSchema = loadedSchemaMap.get(importNamespce);
                        } else if (availableSchemaMap.containsKey(importNamespce)) {
View Full Code Here

    private void addImport(XmlSchema schema, String ns) {
        if (!ns.equals(schema.getTargetNamespace())
            && !ns.equals(WSDLConstants.NS_SCHEMA_XSD)
            && !isExistImport(schema, ns)) {
            XmlSchemaImport is = new XmlSchemaImport(schema);
            is.setNamespace(ns);
            if (this.schemaLocationMapping.get(ns) != null) {
                is.setSchemaLocation(this.schemaLocationMapping.get(ns));
            }
            if (!schema.getItems().contains(is)) {
                schema.getItems().add(is);
            }
        }
View Full Code Here

    private boolean isExistImport(XmlSchema schema, String ns) {
        boolean isExist = false;

        for (XmlSchemaExternal ext : schema.getExternals()) {
            if (ext instanceof XmlSchemaImport) {
                XmlSchemaImport xsImport = (XmlSchemaImport)ext;
                if (xsImport.getNamespace().equals(ns)) {
                    isExist = true;
                    break;
                }
            }
        }
View Full Code Here

    private void addImport(XmlSchema schema, String ns) {
        if (!ns.equals(schema.getTargetNamespace())
            && !ns.equals(WSDLConstants.NS_SCHEMA_XSD)
            && !isExistImport(schema, ns)) {
            XmlSchemaImport is = new XmlSchemaImport();
            is.setNamespace(ns);
            if (this.schemaLocationMapping.get(ns) != null) {
                is.setSchemaLocation(this.schemaLocationMapping.get(ns));
            }
            schema.getItems().add(is);
        }
    }
View Full Code Here

        boolean isExist = false;

        for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
            XmlSchemaObject obj = (XmlSchemaObject)ite.next();
            if (obj instanceof XmlSchemaImport) {
                XmlSchemaImport xsImport = (XmlSchemaImport)obj;
                if (xsImport.getNamespace().equals(ns)) {
                    isExist = true;
                    break;
                }
            }
        }
View Full Code Here

    public static boolean schemaImportsNamespace(XmlSchema schema, String namespaceUri) {
        XmlSchemaObjectCollection inc = schema.getIncludes();
        for (int x = 0; x < inc.getCount(); x++) {
            XmlSchemaObject what = inc.getItem(x);
            if (what instanceof XmlSchemaImport) {
                XmlSchemaImport imp = (XmlSchemaImport)what;
                // already there.
                if (namespaceUri.equals(imp.getNamespace())) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

           
        XmlSchemaObjectCollection inc = schema.getIncludes();
        for (int x = 0; x < inc.getCount(); x++) {
            XmlSchemaObject what = inc.getItem(x);
            if (what instanceof XmlSchemaImport) {
                XmlSchemaImport imp = (XmlSchemaImport)what;
                // already there.
                if (namespaceUri.equals(imp.getNamespace())) {
                    return;
                }
            }
        }
        XmlSchemaImport imp = new XmlSchemaImport();
        imp.setNamespace(namespaceUri);
        inc.add(imp);
        schema.getItems().add(imp);
    }
View Full Code Here

TOP

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

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.