Any reasons for one of these approaches being better/worse than the other?

URL url = Thread.currentThread().getContextClassLoader().getResource("/WEB-INF/test.xml");

InputStream input = url.openStream();
Digester digester = new Digester();
digester.parse(input);


URL url = Thread.currentThread().getContextClassLoader().getResource("/WEB-INF/test.xml");


InputSource is = new InputSource(url.toExternalForm());
is.setByteStream(input);
InputSream input = url.openStream();
Digester digester = new Digester();
digester.parse(is);


ActionServlet does it the second way (InputSource), Tiles code does it the first way (InputStream). I ran into a problem getting Digester to parse xml documents that use "includes" with the InputStream method:


<!DOCTYPE xyz PUBLIC "-//xyz//xyz 1.0//EN" "http://localhost/xyz.dtd"; [
<!ENTITY users SYSTEM "users.xml">
]>
<abc>
   &users;
</abc>

It throws "org.xml.sax.SAXParseException: Relative URI "users.xml"; can not be resolved without a base URI." Switching to the InputSource method let Digester do it's thing, but I'm unclear on why.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to