use:
<class name="Article"> ... <field name="content" type="Content" container="true"/> ... </class>
<class name="Content"> <field name="text" type="string"/> </class>
--Keith
[EMAIL PROTECTED] wrote:
Hi all,
I am having trouble solving the following issue. I have a _given_ xml structure looking like this:
<article> <title>I Am The Title</title> <text><![CDATA[<p>This is some html text</p>]]></text> </article>
I need to map this to the following _given_ classes, i.e. the title element to the title field of the Article class, but the text element to the text field _not_ of the Article class, but of another class called Content (see mapping below):
public class Article {
private String title;
private Content content;
// approporiate getters and setters
... }
public class Content { private String text; ...
// approporiate getters and setters
... }
The mapping:
<mapping>
<class name="Article">
<field name="title" type="java.lang.String">
<bind-xml name="title"/>
</field>
<field name="content" type="Content">
<bind-xml name="text"/>
</field>
</class>
<class name="Content">
?????
</class>
</mapping>
The question marks indicate where I don't know what to write. The points seems to be that in the first class mapping entry, castor already finds a pure text node, so what should the second class mapping entry then be? I tried to simply write <field name="text"/> there, but it threw an Exception (which I cannot reproduce at the moment).
Thanks for your help! Regards Ulrich
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
