Ejemplo n.º 1
0
 /** Transform an InputStream to a dom4j Document. */
 public static Document readDom4j(Source source, boolean handleXInclude) {
   final LocationSAXContentHandler dom4jResult = new LocationSAXContentHandler();
   {
     final XMLReceiver xmlReceiver;
     if (handleXInclude) {
       // Insert XIncludeContentHandler
       xmlReceiver =
           new XIncludeProcessor.XIncludeXMLReceiver(
               null,
               dom4jResult,
               null,
               new TransformerURIResolver(XMLUtils.ParserConfiguration.PLAIN));
     } else {
       xmlReceiver = dom4jResult;
     }
     sourceToSAX(source, xmlReceiver);
   }
   return dom4jResult.getDocument();
 }
Ejemplo n.º 2
0
 /** Transform an InputStream to a dom4j Document. */
 public static Document readDom4j(
     InputStream inputStream, String systemId, boolean handleXInclude, boolean handleLexical) {
   final LocationSAXContentHandler dom4jResult = new LocationSAXContentHandler();
   {
     final XMLReceiver xmlReceiver;
     if (handleXInclude) {
       // Insert XIncludeContentHandler
       xmlReceiver =
           new XIncludeProcessor.XIncludeXMLReceiver(
               null,
               dom4jResult,
               null,
               new TransformerURIResolver(XMLUtils.ParserConfiguration.PLAIN));
     } else {
       xmlReceiver = dom4jResult;
     }
     XMLUtils.inputStreamToSAX(
         inputStream, systemId, xmlReceiver, XMLUtils.ParserConfiguration.PLAIN, handleLexical);
   }
   return dom4jResult.getDocument();
 }