Two corrections:
1. Sorry about the HTML posting.
2. The schema contains an xsd:import for the bogus namespace, so it is
correct except that the namespace does not correspond to any schema.
Jeff
----- Original Message -----
From: Jeff Greif
To: xerces-j-user@xxxxxxxxxxxxxx
Sent: Saturday, April 24, 2004 9:49 AM
Subject: handling of unresolved grammar in preparsing
In preparsing this schema which contains an unresolvable namespace
<schema xmlns:bogus="http://hyperspace/"
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/ns">
<complexType name="RootType">
<sequence>
<element name="ok" type="string"/>
<element name="bad" type="bogus:Random"/>
</sequence>
</complexType>
</schema>
using Xerces 2.2.1 (I know, there is a later, better version), I get
behavior that is not what I want when I supply an entity resolver to the
preparser. If the entity resolver returns null, a non-null grammar is
returned from the preparse, and when I create an XSModel from that grammar,
there is an anyType node in place of the type that cannot be resolved. What
I want is to have an exception thrown, or better, a null grammar returned.
Is there a feature or property that can be set on the preparser to achieve
this? If not in 2.2.1, is there such a feature or property in later
versions of Xerces?
Note that in xerces 2.2.1, I can get the desired behavior by supplying no
entity resolver. In that case, XmlSchemaLoader.resolveDocument() throws a
NullPointerException, which would probably be considered a bug, but for me,
it's a feature!
Jeff
|