Jeff Greif wrote:
From: "Bob Foster" <[EMAIL PROTECTED]>
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).

The problem is I _don't_ know that A references B, and don't have a good way of finding out short of parsing A myself. Since Xerces does know, it would seem pretty simple for it to provide some sort of beginSchema/endSchema callbacks so others could capture the dependency relationships in a grammar pool.


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.

Different question. I believe the schema spec says that failure to locate a schema is not an error, or at least leaves it up to the implementation. It sounds like something that should be settable by the parser user.


Bob

Jeff



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



Reply via email to