Once you have caused the DTD to be loaded up once, you can then tell the
parser to just use it for subsequent parses. There are some limitations to
this.
1) We cannot yet just parse a DTD by itself. So you have to cause the DTD
to be parsed within some file first. This can be a trivial file in an
internal memory buffer that just references the DTD. Once its loaded, then
you can reuse it.
2) The files you are parsing cannot have any internal subset. Because
internal subset overrides external subset, this would cause more
complications than its worth. So the file must have either no DOCTYPE at
all or it must just have an external DTD.
If you can live within those two limitations, then it will do what you
need. The parse() call on the SAX and DOM parsers have an extra parameter
(which is defaulted to false) called 'reuseValidator'. If this is true,
then the currently installed validator is just used as is (without
question, so if its wrong its wrong.)
----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]
"Kirk Benson" <[EMAIL PROTECTED]> on 01/11/2000 11:06:36 AM
Please respond to [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
cc:
Subject: Reuse of parsed DTDs
Hello,
I am interested in a validating C++ XML parser which supports the
following:
1) Relatively large DTD
2) Relatively short documents
3) Parsing speed is important
4) Application parses many documents simultaneously in a multi-thread
program
To support the above, can Xerces allow the DTD to be "pre-parsed" at
application startup, and then applied in parsing many documents in the same
application execution? We have implemented the SP SGML parser currently,
but it is not thread-safe, hence parsing must be serialized.
Thanks for any help,
Kirk Benson
VP Technology
BROKAT Infosystems