This was the very problem I found myself recently.
 
Basically the <xsd:include> and <xsd:import> handlers use the File.isAbsolute method to determine if you have specified a relative path to your schema. If Castor determines the file reference is relative it uses the parsers context to determine the path to the current schema and uses it to make the file reference absolute.
 
So the real problem in this case is that File.isAbsolute does not support URI's, so Castor attempts to prefix a path onto a perfectly good URI reference. In order to work round this I have applied a fix to the CVS version of Castor that will strip the file:/// prefix from the file references before calling the File.isAbsolute method.
 
Andy Fawcett.
 
P.S. it just occurred to me that I need to revisit this and make it work for file:// also! ;-)
-----Original Message-----
From: michael robkin [mailto:[EMAIL PROTECTED]]
Sent: 30 July 2001 19:42
To: [EMAIL PROTECTED]
Subject: [castor-dev] url file name generating sax exceptions

 

  I am using Castor 0.9.2. 

 

 

  I am using a file url in my include statement. Castor generates the following error.

 

  The file is found in f:\baker. I am running windows 2000.

 

  I am using xml spy 4.0 which has validated my files.

 

 

   CASTOR GENERATES THE FOLLLOWING ERROR

 

 

SAXParseException: org.xml.sax.SAXParseException: File "f:/baker/file:///F:/bake/hbstypes.xsd" not found.

- occured at line 0, column 0

 

My code follows:

 

  <?xml version="1.0" encoding="UTF-8"?>

<!-- edited with XML Spy v4.0 NT beta 1 build Jun 13 2001 (http://www.xmlspy.com) by Michael Robkin (Health Business Systems) -->

<xsd:schema targetNamespace="file:///F:/baker/order_summary_info" xmlns:ord="file:///F:/baker/order_summary_info" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">

            <xsd:include schemaLocation="file:///F:/baker/hbstypes.xsd"/>

            <xsd:element name="order_summary_info">

                        <xsd:annotation>

                                    <xsd:documentation>header/detail information Will be able to contain multiple order information[original order split]</xsd:documentation>

                        </xsd:annotation>

                        <xsd:complexType>

                                    <xsd:sequence>

Reply via email to