I'm not sure but you need to describe the way to unmarshall your Room Object
in the mapping.xml file, you need to add something like this in
mapping.house.xml.

<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.org/mapping.dtd";>
<mapping>
   <description>House mapping</description>
   <class name="com.my.House">
      <map-to xml="House" ns-uri="house-ns"/>
         <field name="room" type="com.my.Room">
           <bind-xml name="Room" node="element"/>
        </field>
      ...
     </class>

     <class name="com.my.Room">
<!--Describe the fields into the com.my.Room object in the same way that you
did with com.my.House-->
         <field ...>
         
         </field>
     </class>
</mapping>




AleksFarrier wrote:
> 
> Please help to make correct mapping file.
> I have House bean.
>  public class House
> {
>    private Room room1;
>    private Room room2;
>    .....
> }
> 
> and mapping file mapping.house.xml
> 
> <?xml version="1.0"?>
> <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
> "http://castor.org/mapping.dtd";>
> <mapping>
>     <description>House mapping</description>
>     <class name="com.my.House">
>        <map-to xml="House" ns-uri="house-ns"/>
>           <field name="room" type="com.my.Room">
>             <bind-xml name="Room" node="element"/>
>          </field>
>        ...
>       </class>
> </mapping>
> 
> When I'm trying to create objects from xml file like
> <?xml version="1.0" encoding="UTF-8"?>
> <House xmlns="house-ns">
>   <Room>
>   ....
> </House>
> 
> I taking instance of House class. But all fields inside of House - room
> for example - is null.
> Where is mistake here? 
> 

-- 
View this message in context: 
http://www.nabble.com/The-problem-with-namespace-tp25696855p25696917.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


Reply via email to