DOMParser - Problem 2003-07-29 - By Anthony Rabaa
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-15"> <title></title> </head> <body text="#000000" bgcolor="#ffffff"> Buchleitner Martin wrote:<br> <blockquote type="cite" cite="mid1059466133.b5e7f6e822f8b@(protected)"> <pre wrap="">Hi!
I have to change an existing interface, my problem is that i do not know where to start... The Java-API gets as input an XML-File and an DTD-File to match. But in the XML-File there is not DOCTYPE specified, and - so i think - there results the error. If i assign an DTD manually, then the error isn't raised. But i can not tell all the users to assign DTDs before using this tool. [ Error-Ouptuts at the bottom of the document ]
I would be glade of any information to solve this problem ..
Thanks in advance, Martin </pre> </blockquote> <br> I had the same problem and solved it by loading the file into a buffer, searching for the DOCTYPE statement and replacing the SYSTEM value with my own domain/dtd (<a class="moz-txt-link-freetext" href="http://www .amconresearch.net/foo.dtd">http://www.amconresearch.net/foo.dtd</a>.� The DTD itself was tucked away in the program JAR so I implemented org.xml.sax.EntityResolver and attached it to the DocumentBuilder object.� Each time a request was made, I checked for the domain/dtd and returned the InputStream of the DTD in the JAR.� Having saved the original SYSTEM value in a StringBuffer, I simply reinserted the value during serialization to the file.<br> <br> All together, I believe there were less characters in writing the code than in my response, it's that easy :-)<br> <div class="moz-signature">-- <br> ���<b>Anthony Rabaa</b><br> ���<font size="-1">Software Developer & Network Administrator<br> ����AMCon Research Inc.<br> ����Ottawa, Ontario, Canada<br> ����<a href="http://www.amconresearch.net">http://www.amconresearch.net</a>< /font><br> </div> </body> </html>
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
|
|