Hi again,
 
It seems like I stumbled on another problem related to schema inclusions. The grammar preparser performs only one include in a row. If schema A includes B and B includes C, then the second include will not be resolved. I have no clue why.
 
Alex
-----Original Message-----
From: Aleksandar Milanovic [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 27, 2002 2:52 PM
To: Xerces-J-User
Subject: preparsing grammars with includes: two problems
Importance: High

Hi All,
 
I am using Xerces 2.0.2 and its support for active grammar preparsing. I encountered two problems with schema includes:
 
1.  Incorrect error message about different target namespaces
Schema A includes schema B, both have target namespaces set to 'ex'. The following error message appears when schema A is being preparsed:
 
src-include.2.1: the targetNamespace of the schema 'ex' must be identical to that of the including schema 'ex'
 
The preparser uses a symbol table, so this should not happen. Strangely, this doesn't happen if schema A is preparsed indirectly from another schema C that imports A. Is it possible that the symbol table is not propagated from the schema being preparsed directly to the included schema?
 
2. Inability to resolve imports that have no schema location
Schema A includes schema B, both A and B import schema D, as definitions in D are used in both A and B. However, schema B specifies the schema location of D in the import statement, while schema A only specifies the namespace. This is a valid use of imports and it is justified since imports are not transitive.
It looks like this:
 
Schema A:
<schema..>
    <include schemaLocation="location of schema B"/>
    <import namespace="nsD"/>
</schema>
 
Schema B:
<schema..>
    <import namespace="nsD" schemaLocation="some location"/>
</schema>
 
I use my own entity resolver because schema locations are actually URNs (not URLs). The problem is that the XMLResourceIdentifier passed to my entity resolver for the location-less import has the literal system Id, expanded system Id and public Id set to null, so the entity resolver does not know what schema is being imported. Changing the schema may not be an option, because in this case we are talking about an international standard (schemas for Geography Markup Language). If my entity resolver returns null in this case, then the grammar preparser complains about unrecognized constructs from the imported schema D (which means that the import is indeed required). Shouldn't XMLResourceIdentifier in this case provide some additional information such as the namespace of the imported schema? Any other ideas?
 
Help is appreciated.
 
thx
Alex

-------------------------------------------------------------------------------------
Aleksandar Milanovic     | Privileged or confidential information may be contained
Software Engineer        | in this message. If this message was not intended for you,
Galdos Systems Inc.     | destroy it and notify us immediately.
Tel: (604) 484-2750      | Opinions, conclusions, recommendations, and other
Fax: (604) 484-2755      | information presented in this message are not given or
[EMAIL PROTECTED] | necessarily endorsed by my employer or firm.

 

Reply via email to