use of org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.XMLAssociationProvider in project webtools.sourceediting by eclipse.
the class CMVisitorTest method test.
protected void test(String fileName) {
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
try {
XMLAssociationProvider provider = new XMLAssociationProvider(new CMDocumentCache()) {
};
ModelQuery mq = new ModelQueryImpl(provider);
Thread.currentThread().setContextClassLoader(CMVisitorTest.class.getClassLoader());
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = builder.parse(fileName);
/*
* ClassLoader prevClassLoader =
* Thread.currentThread().getContextClassLoader();
* Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
* Class theClass =
* Class.forName("org.apache.xerces.parsers.DOMParser"); DOMParser
* parser = (DOMParser)theClass.newInstance();
* Thread.currentThread().setContextClassLoader(prevClassLoader);
* parser.parse(new InputSource(fileName)); Document document =
* parser.getDocument();
*/
visitNode(document, mq, 0);
} catch (Exception e) {
e.printStackTrace();
} finally {
Thread.currentThread().setContextClassLoader(originalClassLoader);
}
}
Aggregations