Oops. I again forgot to add the JaxMe address when I sent this message.
--------------
Jochen Wiedmann wrote:
I am sorry, but the problem below is clearly beyond the scope of the
schema parser.
I don't think so. It seems that the XML Schema specification requires
that the parser address it.
XML Schema specification says (part 1, section 4.2.1):
Note: The above is carefully worded so that multiple <include>ing
of the same schema document will not constitute a violation of clause
2 of Schema Properties Correct (�3.15.6), but applications are allowed,
indeed encouraged, to avoid <include>ing the same schema document more
than once to forestall the necessity of establishing identity component
by component.
Although that is only a note, it clearly refers to the concept of the
"same schema document."
It's okay if the parser reads the document multiple times. However, it
must not erroneously think that a single declaration is actually an
illegal multiple declaration (e.g., <xsd:element name="In1"/> in the
test case in my earlier message). JaxMeXS currently does think there's
a duplicate declaration when there is not (assuming I correctly ported
the change to 0.3.1).
The parser will never be able to know, that
"file://.../a.xsd"
and
"a.xsd"
are the same file.
Why not?
It can certainly know whether the URI references "file://.../a.xsd" and
"a.xsd" resolve to the same (non-relative) URI. The first is already a
URI, so that's the (non-relative) URI it resolves to. The second is a
relative reference, so it has to be resolved against the appropriate base
URI (typically, the URI of the document containing the include directive)
to get a (non-relative) URI.
Some part of the parser already has to resolve URI references in order
to read in the referenced document. (That already seems to be handled
in method XSLogicalParser.getInputSource(...).)
In fact, I used your URI resolution in getInputSource() to get
resolved, non-relative URIs and used those resolved URIs (and not the
original URI reference given in the include directive) with the
includedSchemas Set. That seems to work correctly.
The question is what definition of "same document" the XML Schema
specification uses or assumes. I can't check right now, but it
seems it has to be either a direct string comparison of resolved
URIs, or something very close.
(Specifically, I'm sure it would not be a string comparision of
unresolved URI references, and I'm sure it's nothing that requires
network access (e.g., checking whether two DNS host names map to
the same IP address).)
These things are exactly what an EntityResolver is
good for.
That's a different level. I'm not talking about resolution from the
name of a resource to a copy of its data. I'm talking about resolution
from a possibly-relative name to a non-relative name.
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]