Hi Simon, Failure to resolve an import [1] is not an error however Xerces does report a warning to let the user know that it failed. I suspect that you haven't registered a an ErrorHandler with the SchemaFactory. By default (see DraconianErrorHandler) [2] it will silently ignore warnings.
If you write your own ErrorHandler and register it with the SchemaFactory you should get a warning which looks like: schema_reference.4: Failed to read schema document 'file:///C:/bar/foo.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. If you want this warning to be fatal throw an exception from your ErrorHandler. Thanks. [1] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#src-import [2] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html#setErrorHandler(org.xml.sax.ErrorHandler) Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Simon Bøggild" <[EMAIL PROTECTED]> wrote on 11/20/2007 05:05:25 AM: > Hi, > > When using SchemaFactory to load and check a schema file, it seems to > ignore if the schema imports other schemas that doesn't exist. If for > instance there's a typo in the import line in the schema: <import > schemaLocation="file.xsdd" namespace=...>, where the "file.xsdd" > should have been written as "file.xsd", this seems to be ignored. > Sure, it generates an error when trying to process elements in the > schema deriving from the (wrongly spelled) imported schema file, but > it's not the actual misspelling in the import that raises the error. > Is there an option to set somewhere that causes SchemaFactory to throw > an exception if the imported schema does not exist? or is it necessary > to write your own LSResourceResolver implementation that manually > checks if the imported files exist? > > Thanks, > Simon > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]