I have a schema that includes another one: <xsd:include schemaLocation="SchemaCommon.xsd" />
I am using a document builder to validate my XML like this:
When I run this, I get:
schema_reference.4: Failed to read schema document 'SchemaCommon.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>.
src-resolve: Cannot resolve the name 'RecordType' to a(n) 'type definition' component.
Is there a way to append the schema files together somehow?
I'm guessing your problem is in line 5 of the code you posted. Does that res.getFile() method return a complete URL, or just the file part of the URL? I'm guessing (guessing again) that you need to pass a URL as the value of that attribute and not just a file path. That would definitely be true if the URL referred to a jar entry, but you didn't say anything about that.
Joined: Aug 04, 2003
BINGO to using import instead! That did the trick.
subject: Loading a schema that refers to another one.