Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading a schema that refers to another one.

 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
kri shan
Ranch Hand
Posts: 1462
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try <xsd:import schemaLocation="SchemaCommon.xsd" />
 
Paul Clapham
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BINGO to using import instead! That did the trick.

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic