aspose file tools*
The moose likes XML and Related Technologies and the fly likes sax validation against a two file schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "sax validation against a two file schema" Watch "sax validation against a two file schema" New topic
Author

sax validation against a two file schema

spaccount no
Greenhorn

Joined: Jan 30, 2010
Posts: 1
Hi All,

I'm trying to validate xml files against a two file schema.
Everything works fine with the following code:


Here, the ROC xsd file internally points to another file called ROC_Schema1.xsd. This second file is placed in the same folder as ROC.xsd.


So now, I want to make this code generic and accept an inputstream instead of the exact file location.
Question, how do I do that. When I try to pass the stream I get an error. Details below:




The inputstream is being created in main() as follows:



I get the following warning:
Warning:org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'ROC_Schema1.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>.

This naturally leads to issues during validation. I understand, that the stream doesn't contain the second xsd file. So how do I fix this?

Thanks,
Spaccount

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18649
    
    8

"spaccount no", please check your private messages regarding an important administrative matter.

Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sax validation against a two file schema