use of org.eclipse.wst.xml.xpath2.processor.DOMLoader in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method loadDOMDocument.
protected void loadDOMDocument(URL fileURL, Schema schema) throws IOException, DOMLoaderException {
InputStream is = testResolve(fileURL);
DOMLoader domloader = new XercesLoader(schema);
domloader.set_validating(false);
domDoc = domloader.load(is);
domDoc.setDocumentURI(fileURL.toString());
}
use of org.eclipse.wst.xml.xpath2.processor.DOMLoader in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method loadDOMDocument.
protected void loadDOMDocument(URL fileURL, URL schemaURL) throws IOException, DOMLoaderException, SAXException {
InputStream is = testResolve(fileURL);
InputStream schemaIs = testResolve(schemaURL);
Schema jaxpSchema = getSchema(schemaIs);
DOMLoader domloader = new XercesLoader(jaxpSchema);
domloader.set_validating(false);
domDoc = domloader.load(is);
}
use of org.eclipse.wst.xml.xpath2.processor.DOMLoader in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method formatResultString.
protected String formatResultString(String resultFile) throws Exception {
DOMLoader domloader = new XercesLoader(null);
domloader.set_validating(false);
InputStream is = bundle.getEntry(resultFile).openStream();
Document resultDoc = domloader.load(is);
DOMImplementationLS domLS = (DOMImplementationLS) resultDoc.getImplementation().getFeature("LS", "3.0");
LSSerializer serializer = domLS.createLSSerializer();
ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
DelegatingLoader newContext = new DelegatingLoader(originalLoader);
Thread.currentThread().setContextClassLoader(newContext);
String actual = null;
try {
actual = serializer.writeToString(resultDoc.getDocumentElement());
actual = actual.replace("<?xml version=\"1.0\" encoding=\"UTF-16\"?>", "");
return actual.trim();
} finally {
Thread.currentThread().setContextClassLoader(originalLoader);
}
}
use of org.eclipse.wst.xml.xpath2.processor.DOMLoader in project webtools.sourceediting by eclipse.
the class DynamicContextBuilder method retrieve_doc.
// XXX make it nice, and move it out as a utility function
private Document retrieve_doc(URI uri) {
try {
DOMLoader loader = new XercesLoader();
loader.set_validating(false);
Document doc = loader.load(new URL(uri.toString()).openStream());
doc.setDocumentURI(uri.toString());
return doc;
} catch (FileNotFoundException e) {
return null;
} catch (MalformedURLException e) {
return null;
} catch (IOException e) {
return null;
}
}
use of org.eclipse.wst.xml.xpath2.processor.DOMLoader in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathWTPTest method loadDOMDocument.
protected void loadDOMDocument(URL fileURL) throws IOException, DOMLoaderException {
InputStream is = testResolve(fileURL);
DOMLoader domloader = new XercesLoader();
domloader.set_validating(false);
domDoc = domloader.load(is);
domDoc.setDocumentURI(fileURL.toString());
}
Aggregations