Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

[castor-user] [castor-xml] castor 1.3.2: a problem to include a mapping file in
nested including....

吕晓一

2012-03-31


Author LoginPost Reply

Here is my mapping files:

D:\mapping\message\SendSerialCodeSMSReqMap.xml

...

   <include href="../common/SIAPHeaderMap.xml"/>

...

 

D:\mapping\common\SIAPHeaderMap.xml

...

   <include href="SendAddressMap.xml"/>

...

 

D:\mapping\common\SendAddressMap.xml

...

<mapping>

    <class name="com.test.xml.common.SendAddress">

        <map-to xml="SendAddress"/>

        <field name="deviceType" type="java.lang.String">

            <bind-xml name="DeviceType" node="element"/>

        </field>

        <field name="deviceId" type="java.lang.String">

            <bind-xml name="DeviceID" node="element"/>

        </field>

    </class>

</mapping>

...

 

Here is my test code.

 …

Mapping reqMapping = new Mapping();

reqMapping.loadMapping("D:\\mapping\\message\\SendSerialCodeSMSReqMap.xml");

xmlContext.addMapping(reqMapping);

 

It cannot find the SendAddressMap.xml. I looked into the source code, and I found the relative path is always based on the root mapping file(SendSerialCodeSMSReqMap.xml) but not the parent mapping file(SIAPHeaderMap.xml).

 

©2008 junlu.com - Jax Systems, LLC, U.S.A.