private Document getDocument(InputStream is) throws InstantiationException, IllegalAccessException, ClassNotFoundException { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); LSParser parser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null); // we need to ignore whitespace here so the nodeToString() method will be able to indent it properly: parser.setFilter(new IgnoreWhitespaceFilter()); LSInput domInput = impl.createLSInput(); domInput.setByteStream(is); return parser.parse(domInput); }
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { LSInput lsInput = impl.createLSInput(); InputStream is = getClass().getResourceAsStream("/" + systemId); if (is == null) return null; lsInput.setByteStream(is); return lsInput; } }
public static Document parse(InputStream s, boolean validateIfSchema) { DOMImplementationLS impl = getDOMImpl(); LSInput input = impl.createLSInput(); input.setByteStream(s); return parse(input, validateIfSchema); }
public static Document parse(String s, boolean validateIfSchema) { DOMImplementationLS impl = getDOMImpl(); LSInput input = impl.createLSInput(); input.setStringData(s); return parse(input, validateIfSchema); }
/** * Creates LSInput from dom implementation. * @return */ public LSInput createLSInput() { return domImpl.createLSInput(); }
@Override public LSInput resolveResource(final String type, final String namespace, final String publicId, final String systemId, final String baseURI) { if (files.containsKey(systemId)) { final LSInput source = impl.createLSInput(); source.setByteStream(new ByteArrayInputStream(files.get(systemId))); return source; } else { return null; } } }
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { LSInput lsInput = impl.createLSInput(); InputStream is = getClass().getResourceAsStream("/" + systemId); if (is == null) return null; lsInput.setByteStream(is); return lsInput; } }
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { LSInput lsInput = impl.createLSInput(); InputStream is = getClass().getResourceAsStream("/" + systemId); if (is == null) return null; lsInput.setByteStream(is); return lsInput; } }
@Override public LSInput resolveResource(String type, String ns, String pubId, String sysId, String baseURI) { l.debug("Trying to resolve " + type + ", " + ns + ", " + pubId + ", " + sysId + ", " + baseURI + " in package " + pkgPath); // from http://www.java.net/forum/topic/java-web-services-and-xml/jaxp/ // schemafactory-problem-compiling-multiple-schemas-same-na-0 LSInput lsi = dls.createLSInput(); lsi.setByteStream(cll.getResourceAsStream(pkgPath.replace('.', '/') + "/" + sysId)); lsi.setSystemId(sysId); return lsi; } }
/** * Parse a {@code String} into a DOM Document. * * @param content the content to parse * @return a DOM Document corresponding to the input, {@code null} if the content can't be parsed successfully */ public Document parse(String content) { if (content == null) { return null; } LSInput input = this.lsImpl.createLSInput(); input.setCharacterStream(new StringReader(content)); return parse(input); }
/** * @see org.w3c.dom.ls.LSResourceResolver#resolveResource(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { LSInput input = domImpl.createLSInput(); try { input.setByteStream(new ClassPathResource(systemId).getInputStream()); } catch (IOException e) { return null; } return input; } }
/** * Parse a {@code String} into a DOM Document. * * @param content the content to parse * @return a DOM Document corresponding to the input, {@code null} if the content can't be parsed successfully */ public Document parse(String content) { if (content == null) { return null; } LSInput input = this.lsImpl.createLSInput(); input.setCharacterStream(new StringReader(content)); return parse(input); }
private LSInput getLSInput(InputStream is) throws InstantiationException, IllegalAccessException, ClassNotFoundException { final DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); final DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); LSInput domInput = impl.createLSInput(); domInput.setByteStream(is); return domInput; }
public static Document parse(String s, boolean validateIfSchema) { DOMImplementationLS impl = getDOMImpl(); LSInput input = impl.createLSInput(); input.setStringData(s); return parse(input, validateIfSchema); }
public static Document parse(InputStream s, boolean validateIfSchema) { DOMImplementationLS impl = getDOMImpl(); LSInput input = impl.createLSInput(); input.setByteStream(s); return parse(input, validateIfSchema); }
public static Document parse(String s, boolean validateIfSchema) { DOMImplementationLS impl = getDOMImpl(); LSInput input = impl.createLSInput(); input.setStringData(s); return parse(input, validateIfSchema); }
public static Document parse(InputStream s, boolean validateIfSchema) { DOMImplementationLS impl = getDOMImpl(); LSInput input = impl.createLSInput(); input.setByteStream(s); return parse(input, validateIfSchema); }
public XMLDocument(String aSystemId, InputStream aStream) throws XMLException { LSInput input = DomUtils.getDomImplementationLS().createLSInput(); input.setByteStream(aStream); input.setSystemId(aSystemId); doc = read(input, null); }
@Override public LSInput resolveResource(String aType, String aNamespaceURI, String aPublicId, String aSystemId, String aBaseURI) { try { InputStream xslt = resolveImpl(aSystemId).getInputStream(); DOMImplementationLS impl = DomUtils.getDomImplementationLS(); LSInput input = impl.createLSInput(); input.setPublicId(aPublicId); input.setSystemId(aSystemId); input.setByteStream(xslt); return input; } catch (IOException e) { return null; } }
private Document getDocument(InputStream is) throws InstantiationException, IllegalAccessException, ClassNotFoundException { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); LSParser parser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null); // we need to ignore whitespace here so the nodeToString() method will be able to indent it properly: parser.setFilter(new IgnoreWhitespaceFilter()); LSInput domInput = impl.createLSInput(); domInput.setByteStream(is); return parser.parse(domInput); }