[EMAIL PROTECTED] wrote:
> 1. Where does loadGrammar(type, input) method live?
> 
> [...]
> 
> This is why I think a util class with (only) this method is necessary. For
> the kind of requirements Andy mentioned, people can easily preload a
> grammar using this util class, then store it in a grammar pool
> implementation.

There's nothing preventing us from writing such a utility
class and then having the grammar cache implementation use
that utility class internally when someone calls the
"loadGrammar" method on XMLGrammarCache.

> 2. Initialize the object that has loadGrammar(type, input) method
> 
> Currently Xerces supports 2 kinds of grammars: DTD and XML Schema, so
> people would expect to be able to load these two kinds of grammars using
> some object that has a loadGrammar(type, input) method (because, again,
> users shouldn't use classes in impl package directly). If such object
> doesn't live within a parser configuration (it won't if people just want to
> load a grammar and analyze it), then it doesn't have a chance to know
> loaders for DTD and schema.

The reason why I don't like this approach is the following:
if someone doesn't care about one of the types of grammars
(e.g. they don't need XML Schema) but we tell them that 
they should use the utility class, then they now have to
drag along all of the XML Schema stuff.

I'm always striving for a completely layered approach so
that we don't make everything depend on everything else.
So pre-loading a utility class with loaders for DTDs and
XML Schemas is well-intentioned and convenient but would
then require a large dependency in the case where the
user doesn't care about certain types of grammars.

> 3. How validators load grammars
> 
> Andy, from your message, I got the following impression. Correct me if I'm
> wrong.
> 
> When the parser configuration creates various validators, it creates a
> bunch of grammar loaders accordingly, and stores them as different
> properties. Each validator will then query the proper property to get the
> grammar loader, and call loadGrammar(input) on it. The grammar loaders also
> implement XMLComponent interface, so that they'll be aware of any
> feature/property settings.

I wasn't suggesting that. I was actually suggesting that
the validator components would only rely on the grammar
cache being in the configuration. But it would be the
parser configuration's responsibility to create the cache,
add a loader for each type of grammar used in that config,
and then adding the cache as a property.

-- 
Andy Clark * [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to