How about the following field mapping for the 'col' property within the Col class:

<field name="col" type="java.lang.String">
   <bind-xml name="col" node="text"/>
</field>

Have a look at

http://castor.org/xml-mapping.html#3.5-The-%3Cbind-xml%3E-element

as well, where you should find all relevant details related to creating mapping (files).

Werner

ADJA wrote:
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:


---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to