You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Caddel <jc...@cox.net> on 2003/03/21 13:46:03 UTC

Digester Subtlety

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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Digester Subtlety

Posted by Jeff Caddel <jc...@cox.net>.
Apologies for the duplicate msg.  I got a somewhat cryptic reply that 
the orginal had bounced, presumably because it had "xxx" in the xml 
doctype area.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org