|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
The problem with namespacePlease 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? |
|
|
Re: The problem with namespaceI'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>
|
| Free embeddable forum powered by Nabble | Forum Help |