Hiya.

We do a number of things to avoid problems like this.

We make use of EntityResolvers to match both our HTTP proxying environment (ensuring that we cache the results of foreign HTTP DTDs, entities, and other references of that nature) to reduce network overhead and improve performance. At the same time, we process files to ensure that we support reading those files from the WAR using getResource().

Ensure, however, that you are always making sure that any Source you build from has appropriate SystemIDs set - if you don't set the system ID on the source, you can't say where the XML came from, and the parser can only guess at the proper location.

The problem you're having isn't a Castor problem - it's a universal XML parser issue - and it's up to you to ensure that you set up the sources correctly, generally speaking.


On 2 Sep 2005, at 03:25, Kalyani Jitesh wrote:

Hi Keith,

I am bit unlucky. You have replied to all mails sent next to my mail. I missed to get the advice from me.

From last one month I am playing with Castor. And I was about to complete my work, but last moment problem as we say in software not leaving me :-(..

Can you please reply to below mail if you have time..

Regards,
Jitesh

----- Original Message -----
From: Kalyani Jitesh
To: [email protected]
Sent: Wednesday, August 31, 2005 8:26 PM
Subject: [castor-user] [XML] [mapping] xsi:schemaLocation relative path

HI ALL,

I am using castor mapping to load XML into Object. I am validating the XML file against schema by setting the org.exolab.castor.parser.validation=true and other properties. Everything is working fine.

But I have probelm with the Schemalocation. I have given the schema location in XML file as below,
xsi:schemaLocation="http://www.ne.jp/method ./settings.xsd"

Xerces reads this schema location as relative path to XML files location. But Castor reads this location as relative path to current working directory. With this bevaviour of Castor I am not able to validate the XML as actual working directory is not fixed.

How can I change this behaviour of Castor? Or can I set the ShemaLocation during UnMarshlling?

Please reply.

Thanks and Regards,
Jitesh


I have to introduce wrapper class TMLoggerList to have Map of TMLogger to avoid using location. XML before and after unmarshalling and marshalling resp is same as below. ---------------------------------------------------------------------- -----------------------------------------------------
logger.xml
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<tmsettings xmlns="http://www.ne.jp/method";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://www.ne.jp/method ./settings.xsd">
 <logging>
   <logger name="tmcompiler" boundrylevel="5"/>
   <logger name="tmclient" boundrylevel="10"/>
   <logger name="tmwebapp" boundrylevel="15"/>
  </logging>
</tmsettings>
---------------------------------------------------------------------- -----------------------------------------------------
mapping.xml
---------------------
<?xml version="1.0"?>
<ca:mapping  xmlns:ca="http://castor.exolab.org/";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://castor.exolab.org/ mapping.xsd">

<ca:class name="TMSettings">
 <ca:map-to xml="tmsettings" ns-uri="http://www.ne.jp/method"; />
 <ca:field name="loggerList" type="TMLoggerList">
  <ca:bind-xml name="logging" />
 </ca:field>
 </ca:class>

<ca:class name="TMLoggerList">
<ca:map-to xml="logging" ns-uri="http://www.ne.jp/method"; />
<ca:field name="loggerList" collection="map" get- method="getLoggerList"
   set-method="addLogger" type="TMLogger">
   <ca:bind-xml name="logger"/>
  </ca:field>
 </ca:class>

 <ca:class name="TMLogger">
 <ca:map-to xml="logger" ns-uri="http://www.ne.jp/method"; />
 <ca:field name="name" type="string">
   <ca:bind-xml name="name" node="attribute"/>
    </ca:field>
  <ca:field name="boundryLevel" type="string">
   <ca:bind-xml name="boundrylevel" node="attribute"/>
  </ca:field>
 </ca:class>
</ca:mapping>
---------------------------------------------------------------------- -----------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to