Elliotte Rusty Harold wrote:

> Is there any way in Xerces I can easily choose a specific DTD/schema to
> validate documents against from within the parser?
>
At 12:01 AM +0800 3/1/00, Wong Kok Wai wrote:

You can write a class that implements org.xml.sax.EntityResolver and returns
an InputSource that "points" to your local DTD copies. Pass this object to
the SAX parser using setEntityResolver.


This seems to work provided the document in question has a document type declaration with a system or public ID so that the resolveEntity() method will be called. What if the document only has an internal DTD subset, however? Or what if it has no DOCTYPE declaration at all? If I understand this correctly, then no DTD will be used. Is there a way I can specify DTDs for those case?


+-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible (IDG Books, 1999) | | http://metalab.unc.edu/xml/books/bible/ | | http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://metalab.unc.edu/javafaq/ | | Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/ | +----------------------------------+---------------------------------+

Reply via email to