I am new to castor.I am using castor for my xml parsing.I wrote a mapping
file but it is not working.
My input xml is:
<?xml version="1.0" encoding="UTF-8"?>
<Request>
<RequestSegments>
<RequestSegment>
<SearchCriteria>
<Criterion>
<HotelRef HotelCode="253" />
<StayDateRange Start="2009-02-10"
Duration="P1N"
End="2009-02-11" />
<Profiles>
<Profile ProfileType="1"/>
</Profiles>
</Criterion>
</SearchCriteria>
</RequestSegment>
</RequestSegments>
</Request>
I am using a main bean named-MultiVo.In this I have set a bean property
named- AvailVo.In AvailVo I have the
properties-firstEndDate,firstStartDate,and a bean ExtensionVo .In
ExtensionVo I have a property-ProfileType.
ie
public class MultiVo
{
AvailVo objAvailVo;
getter and setter of objAvailVo
}
public class AvailVo
{
private String firstStartDate;
private String firstEndDate;
ExtensionVo objExtension;
getters and setters of firstStartDate,firstEndDate,objExtension
}
public class ExtensionVo
{
private String ProfileType;
}
My problem is that I am not getting the value for profileType
in ExtensionVo .My mapping file is shown below.
<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.org/mapping.dtd">
<mapping>
<class
name="net.vo.MultiVo">
<map-to xml="Request" />
<field name="AvailVo" type="net.vo.AvailVo">
<bind-xml name="RequestSegments" />
</field>
</class>
<class name="net.vo.AvailVo">
<field name="FirstStartDate" type="java.lang.String">
<bind-xml name="Start" node="attribute"
location="RequestSegment/SearchCriteria/Criterion/StayDateRange" />
</field>
<field name="FirstEndDate" type="java.lang.String">
<bind-xml name="End" node="attribute"
location="RequestSegment/SearchCriteria/Criterion/StayDateRange" />
</field>
<field name="ObjExtension" type="net.vo.ExtensionVo">
<bind-xml name="Profiles"/>
</field>
</class>
<class name="net.vo.ExtensionVo">
<field name="ProfileType" type="java.lang.String">
<bind-xml name="ProfileType" node="attribute"
location="RequestSegment/SearchCriteria/Criterion/Profiles/Profile" />
</field>
</class>
</mapping>
Can anyone help me out?
Regards,
Seethal
--
View this message in context:
http://www.nabble.com/Castor-mapping-file-not-working-tp22176664p22176664.html
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email