From: <[EMAIL PROTECTED]> > (BTW, I've already looked at the following mail: > http://www.mail-archive.com/dom4j-dev@lists.sourceforge.net/msg00493.html > and it didn't provide sufficient information for what I need.) > > Hi. I am currently doing the following: > > Document standingXML = > transformer.parseToStandingXML(generator.getDocument()); > standingXML.addDocType("doc", "", "StandingXML.dtd"); > > and then:
BTW if you look at your document via standingXML.asXML() does it look right? > boolean validateXML = true; > SAXReader saxReader = new SAXReader(validateXML); > saxReader.setIncludeInternalDTDDeclarations(true); > saxReader.read(docIn); > where "docIn" is "standingXML". So is there a file called "standingXML" on your file system somewhere? Is it in the current directory, along with the DTD? > However, I get the following exception: > > org.dom4j.DocumentException: null Nested exception: null > at org.dom4j.io.SAXReader.read(SAXReader.java:342) > at org.dom4j.io.SAXReader.read(SAXReader.java:256) > Nested exception: > java.net.MalformedURLException > at java.net.URL.<init>(URL.java:613) > at java.net.URL.<init>(URL.java:476) > at java.net.URL.<init>(URL.java:425) > > I've already put "StandingXML.dtd" into the location where I am compiling > my class "X" so that it will be picked up, but this does not work. > Any ideas? I am don't think I need to use the EntityResolver interface. XML doesn't use the classpath by default to load XML files. If you want to use the classpath or class loader mechanism then you need to pass in a URL yourself. e.g. URL url = getClass().getClassLoader().getResource("standingXML.xml"); SAXReader reader = new SAXReader(); Document doc = reader.read( url ); James ------- http://radio.weblogs.com/0112098/ __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com ------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user