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); } } }
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); } } }
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); } } }
/** * Assist in managing the required <import namespace='uri'> for imports of peer schemas. * @param schema * @param namespaceUri */ public static void addImportIfNeeded(XmlSchema schema, String namespaceUri) { // no need to import nothing or the XSD schema, or the schema we are fixing. if ("".equals(namespaceUri) || XmlSchemaConstants.XSD_NAMESPACE_URI.equals(namespaceUri) || schema.getTargetNamespace().equals(namespaceUri)) { return; } List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return; } } } XmlSchemaImport imp = new XmlSchemaImport(schema); imp.setNamespace(namespaceUri); }
/** * Assist in managing the required <import namespace='uri'> for imports of peer schemas. * @param schema * @param namespaceUri */ public static void addImportIfNeeded(XmlSchema schema, String namespaceUri) { // no need to import nothing or the XSD schema, or the schema we are fixing. if ("".equals(namespaceUri) || Constants.URI_2001_SCHEMA_XSD.equals(namespaceUri) || schema.getTargetNamespace().equals(namespaceUri)) { return; } List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return; } } } XmlSchemaImport imp = new XmlSchemaImport(schema); imp.setNamespace(namespaceUri); }
/** * Assist in managing the required <import namespace='uri'> for imports of peer schemas. * @param schema * @param namespaceUri */ public static void addImportIfNeeded(XmlSchema schema, String namespaceUri) { // no need to import nothing or the XSD schema, or the schema we are fixing. if ("".equals(namespaceUri) || Constants.URI_2001_SCHEMA_XSD.equals(namespaceUri) || schema.getTargetNamespace().equals(namespaceUri)) { return; } List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return; } } } XmlSchemaImport imp = new XmlSchemaImport(schema); imp.setNamespace(namespaceUri); }
/** * Assist in managing the required <import namespace='uri'> for imports of peer schemas. * @param schema * @param namespaceUri */ public static void addImportIfNeeded(XmlSchema schema, String namespaceUri) { // no need to import nothing or the XSD schema, or the schema we are fixing. if ("".equals(namespaceUri) || XmlSchemaConstants.XSD_NAMESPACE_URI.equals(namespaceUri) || schema.getTargetNamespace().equals(namespaceUri)) { return; } List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return; } } } XmlSchemaImport imp = new XmlSchemaImport(schema); imp.setNamespace(namespaceUri); }
/** * Assist in managing the required <import namespace='uri'> for imports of peer schemas. * @param schema * @param namespaceUri */ public static void addImportIfNeeded(XmlSchema schema, String namespaceUri) { // no need to import nothing or the XSD schema, or the schema we are fixing. if ("".equals(namespaceUri) || XmlSchemaConstants.XSD_NAMESPACE_URI.equals(namespaceUri) || schema.getTargetNamespace().equals(namespaceUri)) { return; } List<XmlSchemaExternal> externals = schema.getExternals(); for (XmlSchemaExternal what : externals) { if (what instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)what; // already there. if (namespaceUri.equals(imp.getNamespace())) { return; } } } XmlSchemaImport imp = new XmlSchemaImport(schema); imp.setNamespace(namespaceUri); }
public void addXmlSchemaImport(XmlSchema rootSchema, XmlSchema schema, File file) { // Make sure we haven't already imported the schema. String importNamespace = schema.getTargetNamespace(); boolean included = false; for (XmlSchemaExternal ext : rootSchema.getExternals()) { if (ext instanceof XmlSchemaImport) { XmlSchemaImport imp = (XmlSchemaImport)ext; if (imp.getNamespace().equals(importNamespace)) { included = true; break; } } } if (!included) { XmlSchemaImport importSchema = new XmlSchemaImport(rootSchema); if (!ignoreImports) { importSchema.setSchemaLocation(file.toURI().toString()); } importSchema.setNamespace(schema.getTargetNamespace()); } if (!importedSchemas.containsKey(file)) { importedSchemas.put(file, schema); } }
protected void addImport(XmlSchema xmlSchema, QName schemaTypeName) { NamespacePrefixList map = xmlSchema.getNamespaceContext(); if (map == null || ((map instanceof NamespaceMap) && ((NamespaceMap) map).values() == null) || schemaTypeName == null) { return; } if (map instanceof NamespaceMap && !((NamespaceMap) map).values(). contains(schemaTypeName.getNamespaceURI())) { XmlSchemaImport importElement = new XmlSchemaImport(xmlSchema); importElement.setNamespace(schemaTypeName.getNamespaceURI()); if (!xmlSchema.getItems().contains(importElement)) { xmlSchema.getItems().add(importElement); } ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(), schemaTypeName.getNamespaceURI()); } }
protected void addImport(XmlSchema xmlSchema, QName schemaTypeName) { NamespacePrefixList map = xmlSchema.getNamespaceContext(); if (map == null || ((map instanceof NamespaceMap) && ((NamespaceMap) map).values() == null) || schemaTypeName == null) { return; } if (map instanceof NamespaceMap && !((NamespaceMap) map).values(). contains(schemaTypeName.getNamespaceURI())) { XmlSchemaImport importElement = new XmlSchemaImport(xmlSchema); importElement.setNamespace(schemaTypeName.getNamespaceURI()); if (!xmlSchema.getItems().contains(importElement)) { xmlSchema.getItems().add(importElement); } ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(), schemaTypeName.getNamespaceURI()); } }
/** * Resolves schema imports by adding an schema import section to the host schema. * @param hostSchema The host schema * @param refNamespace The external schema reference */ private static void resolveSchemaImports(XmlSchema hostSchema, String refNamespace) { if (!hostSchema.getTargetNamespace().equals(refNamespace)) { XmlSchemaImport schemaImport = new XmlSchemaImport(); schemaImport.setNamespace(refNamespace); if (!containsSchemaImport(hostSchema, schemaImport)) { hostSchema.getItems().add(schemaImport); } } }
Element schemaEl) { XmlSchemaImport schemaImport = new XmlSchemaImport();
Element schemaEl) { XmlSchemaImport schemaImport = new XmlSchemaImport();
Element schemaEl) { XmlSchemaImport schemaImport = new XmlSchemaImport();
XmlSchemaImport importElement = new XmlSchemaImport(xmlSchema); importElement.setNamespace(tgtNamespace); xmlSchema.getItems().add(importElement);
XmlSchemaImport wsaImport = new XmlSchemaImport(schema); wsaImport.setNamespace(ReferenceConstants.WSADDRESSING_NAMESPACE); wsaImport.setSchemaLocation(ReferenceConstants.WSADDRESSING_LOCATION);
XmlSchemaImport importElement = new XmlSchemaImport(xmlSchema); importElement.setNamespace( typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
XmlSchemaImport importElement = new XmlSchemaImport(xmlSchema); importElement.setNamespace( typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
XmlSchemaImport wsaImport = new XmlSchemaImport(s); wsaImport.setNamespace(ReferenceConstants.WSADDRESSING_NAMESPACE); wsaImport.setSchemaLocation(ReferenceConstants.WSADDRESSING_LOCATION);