Problem solved:
http://www.nabble.com/forum/ViewPost.jtp?post=12978820&framed=y



ADJA wrote:
> 
> Thanks for the answer. The mapping you suggested certainly works, but it
> breaks the structure that I need to return.
> 
> In my case I have:
> 
> <PAGE src="mypage.jsp">
> __<TABLE name="user">
> ____<ROW version="current">
> ______<COL key="user">
> ________Test User is a Sample
> ______</COL>
> 
> I should return a "col" object which contains both "key=user" (the
> property) and "Test User is a Sample" (The value). The way you suggested,
> if I am not mistaken, will associate the value (Test User...) with the
> "ROW" object instead. The "row" will contain lots of "col"s.
> 
> Unfortunately, the structure of the XML cannot be altered so I hope Castor
> can save my day :rules:
> 
> Thanks again.
> 
> 
> Delory Christophe wrote:
>> 
>> 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 october 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
>> 
>> 
>> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-map-this-XML-structure--tf4548184.html#a12980660
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