Unfortunately that method is not very user friendly here is the code:
public void setBaseURL( String url )
{
try {
_resolver.setBaseURL( new URL( url ) );
} catch ( MalformedURLException except ) { }
}
So if an error occurs...it won't tell you.
You need to use a valid URL, and you did not. You used a windows path,
not a URL.
Change your code to:
map.setBaseURL("file:///C:/test/castor/map/");
Sorry for the very poor error reporting.
--Keith
Ide Roth wrote:
>
> Sorry if I confuse anybody but the error message is wrong.
> The correct error message is : org.xml.sax.SAXException: Parsing Error : File
>"file:///C:/test/castor/other_mapping.xml" not found.
>
> Instead of org.xml.sax.SAXException: Parsing Error : File
>"file:///C:/test/castor/map/other_mapping.xml" not found.
>
> I was running my program from the directory "C:/test/castor/" and the mapping files
>are in "C:/test/castor/map/" directory.
>
> thanks,
> Ide
>
> >>> [EMAIL PROTECTED] 01/18/02 09:28AM >>>
> I have several mapping files that reference other mapping files. All of the mapping
>files is one directory. Here an example of a mapping file in a dir
>C:/test/castor/map/other_mapping.xml:
>
> <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
> "http://castor.exolab.org/mapping.dtd">
> <mapping>
>
> <include href="other1_mapping.xml"/>
> <include href="other2_mapping.xml"/>
> <include href="other3_mapping.xml"/>
> ...
>
> </mapping>
>
> ___________
>
> Here the code I have to load the mapping file:
>
> Mapping map = new Mapping();
> //Mapping map = new Mapping( getClass().getClassLoader() );
> map.setBaseURL("C:/test/castor/map/");
> map.loadMapping( "other_mapping.xml" );
>
> When I run the code I get an error message :
>
> -->Error : org.exolab.castor.mapping.MappingException: Nested error:
>org.xml.sax.SAXException: Parsing Error : File
>"file:///C:/test/castor/map/other_mapping.xml" not found.
> Line : 0
> Column : 0
> org.xml.sax.SAXException: Parsing Error : File
>"file:///C:/test/castor/map/other_mapping.xml" not found.
> Line : 0
> Column : 0
> at
>org.exolab.castor.xml.UnmarshalHandler.fatalError(UnmarshalHandler.java:1117)
> at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1225)
> at
>org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:512)
> at org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:312)
> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1080)
> at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
> at org.exolab.castor.mapping.Mapping.loadMappingInternal(Mapping.java:477)
> at org.exolab.castor.mapping.Mapping.loadMappingInternal(Mapping.java:436)
> at org.exolab.castor.mapping.Mapping.loadMapping(Mapping.java:363)
> at XMLConverter.<init>(XMLConverter.java:44)
> at XMLConverter.main(XMLConverter.java:128)
> _______________________
>
> It seems that the setBaseURL() is not working. Could someone tell me what I'm
>doing wrong?
>
> Thanks you in advance,
> Ide
>
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev