/** * Returns true if the file can be parsed as XML and it contains one of the given namespace URs */ public static boolean hasNamespace(Path file, String... namespaceURis) { try { return XmlHelper.hasNamespace(getNamespaces(file), namespaceURis); } catch (Exception e) { LOG.warn("Failed to parse XML " + file + ". " + e, e); return false; } }
protected FileSystemXmlApplicationContext createContext(Path path, String url) { if (!Paths.hasNamespace(path, SPRING_BEANS_NAMESPACE_URI)) { LOG.info("Ignoring XML file " + path + " which is not a spring XML"); return null; } String[] locations = {url}; if (parentApplicationContext != null) { return new FileSystemXmlApplicationContext(locations, true, parentApplicationContext); } else { return new FileSystemXmlApplicationContext(locations, true); } }
/** * Returns true if the file can be parsed as XML and it contains one of the given namespace URs */ public static boolean hasNamespace(Path file, String... namespaceURis) { try { return XmlHelper.hasNamespace(getNamespaces(file), namespaceURis); } catch (Exception e) { LOG.warn("Failed to parse XML " + file + ". " + e, e); return false; } }