Internally, we validate by numbers. If the validation was done externally
via public API, then it would have to be done by strings. This would be
significantly slower. For instance, a DTD content model is reduced to a an
array of arrays of numbers when its in DFA form. Internally, those are the
actual numbers that the scanner stores and passes to the validator to
validate. If it were done on top of the system, via public APIs, everything
would have to work in terms of strings that would have to be re-tokenized
in some way.
So, yes its very fast doing it the way we currently do.
If you want to revalidate some file that you've created, you either have it
a memory buffer, which you just stream back into the parser via a memory
buffer input stream. Or, you have some sort of DOMInputSource that streams
the data from a DOM tree back into the parser to be validated. The parser
has an abstraction for where the data comes from, so it can be made to come
from pretty much anything you want to store it in.
And we are very much making use of abstractions. The validator abstraction
is just such a thing. Both DTD and Schema validators will work via this
same abstraction and the scanner does not have to know what it really is
dealing with.
----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]
Paul Prescod <[EMAIL PROTECTED]> on 01/13/2000 04:55:45 PM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: Re: Validator
Is it really the case that the protocol between parser and validator
could become a huge performance drain?
I would have expected it to be a quiet conversation in comparison to the
noise of Unicode character lookups, URL fetches, lexical analysis,
well-formedness checking, and so forth. My experience is that the best
XML parsers often work at IO speeds (at least on my computer) so there
is probably time to spare for a little abstraction and code reuse.
What if I want to validate the result of an Xalan transform? Do I have
to stream it to disk?
--
Paul Prescod - ISOGEN Consulting Engineer speaking for himself
"Remember, Ginger Rogers did everything that Fred Astaire did,
but she did it backwards and in high heels."
--Faith Whittlesey