The following will do it:
<field name="col" type="java.lang.String">
<bind-xml node="text"/>
</field>
-----Message d'origine-----
De : ADJA [mailto:[EMAIL PROTECTED]
Envoyé : lundi 1 octobre 2007 14:56
À : [email protected]
Objet : [castor-user] How to map this XML structure?
Hi,
I am new to castor and trying to create valid mapping for the following
sample XML structure:
<PAGE src="mypage.jsp">
__<TABLE name="user">
____<ROW version="current">
______<COL key="user">
________Test User is a Sample
______</COL>
______<COL key="vald">
________No validation apply
______</COL>
____</ROW>
____<ROW version="100">
______...
____</ROW>
__</TABLE>
__<TABLE name="user2">
____...
__</TABLE>
</PAGE>
So I created the following Java Classes:
Class Page
Class Table
Class Row
Class Col
... and I got stuck in "Col"?! I have no problem reading the attributes of
the <col> tag, but I had no luck reading the value, ie "Test User is a
Sample". I keep getting an exception that invalid data appeared in <col>!!
Here is the mapping for this part:
__<field name="cols" type="my.package.Col" collection="collection">
____<bind-xml name="col" node="element"/>
__</field>
...
__<class name="my.package.Col">
____<field name="key" type="java.lang.String">
______<bind-xml name="key" node="attribute"/>
____</field>
<!-- I know this part is wrong -->
____<field name="col" type="java.lang.String">
______<bind-xml name="col" node="element"/>
____</field>
__</class>
Any ideas? :working:
--
View this message in context:
http://www.nabble.com/How-to-map-this-XML-structure--tf4548184.html#a12978713
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email