Can I read XML config documents from an EAR file? I can do getResourceAsStream, of course ... but I am not sure how I could point the parser to a location within the EAR file to locate the DTDs. I want to package the DTDs in the EAR file as well to ensure the XML doc and DTD are the same version.
You can always create a directory within your WEB-INF dir and read from them using this piece of code. Any file within WEB-INF will not be server to the client and hence is also secure.
InputStream xmlStream = getServletContext().getResourceAsStream("/WEB-INF/xml/test.xml");