Is there any way in Xerces I can easily choose a specific DTD/schema to
validate documents against from within the parser? 

For example, suppose I have thousands of unrelated customers sending me
documents that represent an order. Before accepting the order, I want to
validate these documents against a known DTD. However, the documents
sent to me are merely well-formed and specifcally do not contain
document type declarations. Alternately some of them contains document
type declarations, but pointing to DTDs on the customers' servers, not
mine.

I would like to compare these documents to my DTD regardless of what the
document type declaration says. I suppose I could build a DOM tree,
insert my own document type declaration, repalcing the original one if
necessary, and then validate, but that seems excessively onerous.  Is
there an easier eay to tell Xerces (or, for that matter, any other
parser) that I want to apply a particular DTD to a particular document? 

-- 
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|               Java I/O (O'Reilly & Associates, 1999)               |
|            http://metalab.unc.edu/javafaq/books/javaio/            |
|   http://www.amazon.com/exec/obidos/ISBN=1565924851/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