コード例 #1
0
ファイル: XMLContextTest.java プロジェクト: phan-pivotal/OSS
 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);
 }
コード例 #2
0
 public Object instantiate() {
   return XMLHelper.generateDom4jElement(nodeName);
 }