Hi,
here a suggestion. Can you please create an instance of AvailVo,
populate it with the desired values (and objects), and use the
Marshaller to produce XML from it.
This way any mapping problems will get much more obvious.
Regards
Werner
nja wrote:
> 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
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email