March 04, 2004

Retrieving DTDs

John wrote:

> Hi Nicolas,
> I wonder if you could answer a problem I am having
> processing an XML file with a Java application. The
> XML file is ejb-jar.xml. There is a line referencing a
> DTD e.g. > Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
> "http://java.sun.com/dtd/ejb-jar_2_1.dtd">.
> However, when my internet connection or java.sun.com
> is down, I am unable to retrieve the dtd and thus get
> a FileNotFoundException. I have tried saving the dtd
> in the java classpath with no success. The error
> occurs when I call: builder.parse(new
> File("ejb-jar.xml"));
>
> Any suggestions or comments would be appreciated.
> thanks.../john

Hi, John!

The trouble is that the parser is trying to retrieve the file
from http://java.sun.com/dtd/ejb-jar_2_1.dtd. You can solve
this problem by saving a local copy to the same directory as
the XML file and changing the DOCTYPE declaration to read

"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"ejb-jar_2_1.dtd">

I hope that helps!

---- Nick

Technorati tags: XML | DTD | technology | DOM | Document Object Model | Document Type Definition |

src="http://feeds.feedburner.com/~s/ChaosMagnet?i=http://www.chaosmagnet.com/blog/archives/000359.html" type="text/javascript" charset="utf-8">
Posted by roadnick at March 4, 2004 10:55 AM | TrackBack

Comments

Post a comment









Remember personal info?