Daniel Jackson wrote:


David Bertoni wrote:
You can't store two different schemas with the same target namespace URI in the same grammar pool. As you've noticed, this is because the pool uses the target namespace URI as the key. It works this way because that's how the parser finds a grammar for a particular element during validation -- it uses the namespace URI of the element to validate.


I see. So if I have a scenario as follows: I want to validate a XML file
with schema A. Schema A includes schema B (both have the same namespace).
When using one of the parsers and calling loadGrammar to load schema A, the
parser will try to resolve schema B but will not cache it? Where does it go
then?
As long as schema A includes B, all of the components defined in B will be available. What won't work is if schema A doesn't include schema B, but you need components in both schemas, so you attempt to load both grammars separately.

And if afterwards I try to use that XMLGrammarPool with a different parser
will the same XML pass schema validation? Or will it fail because it can't
find schema B?
As long as one of the schema documents includes the other, you're fine. If that's not the case, the easiest thing to do is to create a single top-level schema document that just includes both A and B.

Does that clarify things?

Dave

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

Reply via email to