Example #1
0
 public void testAll() throws Exception {
   XMLHelper xmlHelper = new XMLHelper();
   ClassLoader cl = Thread.currentThread().getContextClassLoader();
   InputStream is = cl.getResourceAsStream("org/hibernate/test/annotations/reflection/orm.xml");
   assertNotNull("ORM.xml not found", is);
   XMLContext context = new XMLContext();
   List errors = new ArrayList();
   SAXReader saxReader =
       xmlHelper.createSAXReader("XML InputStream", errors, EJB3DTDEntityResolver.INSTANCE);
   // saxReader.setValidation( false );
   try {
     saxReader.setFeature("http://apache.org/xml/features/validation/schema", true);
   } catch (SAXNotSupportedException e) {
     saxReader.setValidation(false);
   }
   org.dom4j.Document doc;
   try {
     doc = saxReader.read(new InputSource(new BufferedInputStream(is)));
   } finally {
     try {
       is.close();
     } catch (IOException ioe) {
       // log.warn( "Could not close input stream", ioe );
     }
   }
   assertEquals(0, errors.size());
   context.addDocument(doc);
 }
 public Object instantiate() {
   return XMLHelper.generateDom4jElement(nodeName);
 }