Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help for warning: src-import.0: Failed to read imported schema document

 
mike nu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I am trying to validate an XML document against a master schema. In my master schema document, I imported some other namespaces by using import like this:

<import namespace="http://www.xyz.com/schema/Test.xsd" schemaLocation= "Test.xsd" />

When I tried to run it, I got warning says:

src-import.0: Failed to read imported schema document 'Test.xsd'.

Does anyone had such experience and know what cause this problem?

Thanks,

Mike
 
Brian Nielsen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Mike

Can't answer directly, but are you sure the XSD's are situated in the same folder. For further ideas what platform and parser are you using?

Regards Brian
 
mike nu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian,

Thanks for your reply. Here is my code:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

factory.setNamespaceAware(true);
factory.setValidating(true);
factory.setIgnoringElementContentWhitespace(true);
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", getSchemaURLs());
builder = factory.newDocumentBuilder();

The method getSchemaURLs() will return a File[] for schemas on my local machine.

Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic