Package org.apache.ws.commons.schema

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


        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


                    xmlSchema.getIncludes().add(includeElement);
                }
            }
        } else {
            if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values().contains(schemaTypeName.getNamespaceURI())) {
                XmlSchemaImport importElement = new XmlSchemaImport();
                importElement.setNamespace(schemaTypeName.getNamespaceURI());
                xmlSchema.getItems().add(importElement);
                ((NamespaceMap)xmlSchema.getNamespaceContext()).put(generatePrefix(), schemaTypeName.getNamespaceURI());
            }
        }
    }
View Full Code Here

                    equals(xmlSchema.getNamespaceContext().getNamespaceURI(prefixes[count])) ) {
                return prefixes[count];
            }
        }

        XmlSchemaImport importElement = new XmlSchemaImport();
        importElement.setNamespace(schemaTypeName.getNamespaceURI());
        xmlSchema.getItems().add(importElement);
        prefix = generatePrefix();
        //it is safe to cast like this since it was this class that instantiated the
        //NamespaceContext and assigned it to an instance of a NamespaceMap (see method getXmlSchema)
        ((NamespaceMap)xmlSchema.getNamespaceContext()).put(prefix,
View Full Code Here

                    xmlSchema.getItems().add(includeElement);
                }
            }
        } else {
            if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values().contains(schemaTypeName.getNamespaceURI())) {
                XmlSchemaImport importElement = new XmlSchemaImport();
                importElement.setNamespace(schemaTypeName.getNamespaceURI());

                // Add schemaLocation on imports
                String schemaLocation = (String)schemaLocationMap.get(schemaTypeName.getNamespaceURI());
                importElement.setSchemaLocation(schemaLocation);
                xmlSchema.getItems().add(importElement);
                ((NamespaceMap)xmlSchema.getNamespaceContext()).put(generatePrefix(), schemaTypeName.getNamespaceURI());
            }
        }
    }
View Full Code Here

    private void addWSAddressingImport(XmlSchema s) {
        boolean alreadyImported = false;
        for (Iterator i = s.getIncludes().getIterator(); i.hasNext();) {
            java.lang.Object o = i.next();
            if (o instanceof XmlSchemaImport) {
                XmlSchemaImport schemaImport = (XmlSchemaImport)o;
                if (schemaImport.getNamespace().equals(ReferenceConstants.WSADDRESSING_NAMESPACE)) {
                    alreadyImported = true;
                    break;
                }
            }
        }
       
        if (!alreadyImported) {
            // We need to add an import statement to include the WS addressing types
            XmlSchemaImport wsaImport = new XmlSchemaImport();
            wsaImport.setNamespace(ReferenceConstants.WSADDRESSING_NAMESPACE);
            wsaImport.setSchemaLocation(ReferenceConstants.WSADDRESSING_LOCATION);
            s.getItems().add(wsaImport);
            s.getIncludes().add(wsaImport);
        }
       
        // Add the addressing namespace to the WSDLs list of namespaces.
View Full Code Here

        String importNamespace = schema.getTargetNamespace();
        boolean included = false;
        for (Iterator i = rootSchema.getIncludes().getIterator(); i.hasNext();) {
            Object o = i.next();
            if (o instanceof XmlSchemaImport) {
                XmlSchemaImport imp = (XmlSchemaImport)o;
                if (imp.getNamespace().equals(importNamespace)) {
                    included = true;
                    break;
                }
            }
        }

        if (!included) {
            XmlSchemaImport importSchema = new XmlSchemaImport();
            if (!ignoreImports) {
                importSchema.setSchemaLocation(file.toURI().toString());
            }
            importSchema.setNamespace(schema.getTargetNamespace());
            rootSchema.getItems().add(importSchema);
            rootSchema.getIncludes().add(importSchema);
        }
        if (!importedSchemas.containsKey(file)) {
            importedSchemas.put(file, schema);
View Full Code Here

        org.w3c.dom.Element el = schema.getAllSchemas()[0].getDocumentElement();
        wsdlSchema.setElement(el);
       
        XmlSchemaObjectCollection imports = schema.getIncludes();
        for (java.util.Iterator<XmlSchemaObject> it = CastUtils.cast(imports.getIterator()); it.hasNext();) {
            XmlSchemaImport xmlSchemaImport = (XmlSchemaImport) it.next();
            SchemaImport schemaimport =  wsdlSchema.createImport();
            schemaimport.setNamespaceURI(xmlSchemaImport.getNamespace());
            if (xmlSchemaImport.getSchemaLocation() != null
                && !ignoreImports) {
                schemaimport.setSchemaLocationURI(xmlSchemaImport.getSchemaLocation());
            }
            wsdlSchema.addImport(schemaimport)
        }
        types.addExtensibilityElement(wsdlSchema);
    }
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

    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

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.