----- Original Message ----- 
From: "Bob Foster" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 04, 2004 11:10 AM
Subject: Problem with grammar pool


> My XMLGrammarPool implementation keeps a cache of grammars, invalidating
> the cache when a grammar is modified. This works quite well when a
> document directly references a schemaLocation of, say, A.xsd. If A.xsd
> is modified and the document revalidated, the pool correctly does not
> return the cached grammar, allowing Xerces to recalculate it.
>
> The problem arises when A.xsd includes or imports B.xsd and B.xsd is
> changed. Even though the cached grammar for B.xsd is refreshed, when the
> document is revalidated the consolidated schema representing A.xsd,
> which incorporates information from the previous version of B.xsd, still
> appears to be up-to-date and is incorrectly used for validation.

It appears that you know for sure that the grammar in the pool for A
includes rather referencing constructs from B.  I'm curious to know why this
would be done (as an optimization or to satisfy some functional
requirement).

I've noticed something similar.  If you use grammar preparsing to construct
the grammar for A.xsd, and the import B is not found by the entity resolver
or any default mechanism, the parsing of A does not stop (whether the
resolver returns null or throws an IOException)  Instead, the grammar for A
is constructed with all references to types in the namespace for B replaced
by xsd:anyType.  This seems like incorrect behavior to me.  Is there a
justification?  I can provide a test case if necessary.

Jeff


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

Reply via email to