[xsd-users] RE: Problem getting code to read data from files including using XInclude

Boris Kolpackov boris at codesynthesis.com
Wed Jul 22 13:58:21 EDT 2009


Hi Tim,

Tim Muirhead <Tim.Muirhead at tibra.com> writes:

> It will give a runtime error
> test.xml:9:53 error: no scheme found in URI
> 
> This only occurs when trying to include the file
>   <TestComplex>
>     <xin:include href="testRef.xml" />
>   </TestComplex>
> 
> It is definitely picking up the correct file - as if you put in a 
> invalid file name you get an 'unable to include resource 'bogusfile.xml'
> Also, the testRef.xml file appears valid.

I investigated this a bit and it appears this is not about the validity
of the file but rather about the URI scheme (e.g., http://, file://, etc).
For some reason, XInclude implementation in Xerces-C++ does not like it
when you have a relative path as system id. That is, if I try to use
/tmp/test.xml, everything works but if I use just test.xml, I get the
above error. I have filed a bug report about this:

https://issues.apache.org/jira/browse/XERCESC-1879

One way to work around this problem is to use the LocalFileInputSource
class provided by Xerces-C++ instead of fstream. Internally this class
makes all relative paths absolute. I have updated your test to show how
to do this:

http://www.codesynthesis.com/~boris/tmp/xsdTest2.zip

Boris




More information about the xsd-users mailing list