Support Requests item #1012187, was opened at 2004-08-19 15:39 Message generated for change (Comment added) made by maartenc You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=216035&aid=1012187&group_id=16035
Category: None Group: None Status: Open Priority: 5 Submitted By: Larry Cryderman (lcryderm) >Assigned to: Maarten Coene (maartenc) Summary: DOM4J reading local file DTD Initial Comment: My inbound XML documents reference a file dtd such as '<!DOCTYPE Foo SYSTEM "Foo.dtd">....I can't obtain a Document object from the SAXReader because it can't resolve the URI. I've tried using an EntityResolver, but it's never even referenced. Help plz! ---------------------------------------------------------------------- >Comment By: Maarten Coene (maartenc) Date: 2004-08-22 14:40 Message: Logged In: YES user_id=178745 Hi Larry, 1. The reason the SAXReader can't resolve the URI is that you didn't specify a systemID in your InputSource. If you use dom4j, you don't have to create the InputSource yourself, but you can use one of these methods below which create the InputSource for you: org.dom4j.io.SAXReader.read(File) org.dom4j.io.SAXReader.read(InputStream, String) org.dom4j.io.SAXReader.read(Reader, String) org.dom4j.io.SAXReader.read(URL) Please use one of these methods for creating your Document. If you use the read(File) or read(URL) method, the DTD has to be located in the same directory as your XML document. If you use the other methods, you'll have to provide the systemID yourself. 2. The reason that your EntityResolver is not used is hard to say if you don't provide your source code. However, some SAX Parser don't use the EntityResolver in some situations, even if you have specified one. Perhaps you can try to use the Xerces XML parser, which is behaving correctly in this situation. You can do this like this: org.dom4j.io.SAXReader reader = new org.dom4j.io.SAXReader ("org.apache.xerces.parsers.SAXParser"); Did this solve your problems? regards, Maarten ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=216035&aid=1012187&group_id=16035 ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev