posted 19 years ago
I have a Swing app that stores its data in XML, reading the data back in with Xerces SAX. If my understanding is correct, then those XML data files need to have a DTD defined in the DOCTYPE tag, so I do that like this:
I don't want these data files to be validated by the SAX parser, so I specify as such like this:
However, I've found that even with validation set to false, I still need to provide a DTD for the parser. So in this case (according to my DOCTYPE tag), I need a DTD named "appprefs.dtd" in the same directory as my app's executable. To ensure the existence of that DTD file, before any parsing takes place, I have my app look for that file's existence and if it doesn't exist, writes it out.
The problem with that is that I've discovered that my approach doesn't ensure the DTD's existence. I've had some customers "lose data", and when reviewing their log files, have found that for whatever reasons they sometimes get IOExceptions of the "access denied" variety; they can't write the DTD file to that directory.
So... I'm kind of at a loss at the best way to fix this. Does anyone have a similar scenario that works? Is there a way that I can specify like an in-memory DTD? Or is there same way that I am unaware of that I can just do without providing a DTD altogether?
Thanks in advance.
[ April 27, 2005: Message edited by: dave taubler ]
Dave Taubler<br />Specializing in <a href="http://taubler.com/articles/" target="_blank" rel="nofollow">Java and Web Development</a>