Hi Henry, the stuff between your "<test_bean...>" tag (i.e. Mister Jones) is 
not an element node, it's a "text" node.  So on the field you have in your 
mapping named "v_Test_bean", change the "node" attribute on the bind-xml tag to 
have a value "text" instead of "element".

Craig.

--
Craig Tataryn
site: http://www.basementcoders.com/
podcast: http://www.basementcoders.com/?feed=podcast
itunes: http://itunes.apple.com/podcast/the-basement-coders
irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
twitter: craiger

On 2010-06-19, at 5:26 PM, Henry Lu wrote:

> I have code:
> 
> public class Test_bean
> {
> 
>   private String id;
>   private String v_Test_bean;
> 
>   public Test_bean()
>   {
> 
>   }
> 
>   public String getId()
>   {
>      return id;
>   }
> 
>   public void setId(String id)
>   {
>      this.id = id;
>   }
> 
>   public String getV_Test_bean()
>   {
>      return v_Test_bean;
>   }
> 
>   public void setV_Test_bean(String test_bean)
>   {
>      v_Test_bean = test_bean;
>   }
> 
> }
> 
> and xml file:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <test_bean id="1">
> Mister Jones
> </test_bean>
> 
> and mapping file:
> 
> <?xml version="1.0"?>
> 
> <mapping>
> <class name="com.xyz.Test_bean">
> 
> <map-to xml="test_bean"/>
> 
> <field name="id" type="string">
> <bind-xml name="id" node="attribute"/>
> </field>
> 
> <field name="v_Test_bean" type="string">
> <bind-xml name="test_bean" node="element"/>
> </field>
> </class>
> </mapping>
> 
> and I got the following errors when I ran my program:
> 
> OK-Util.getApplicationContext-OK
> org.springframework.oxm.UnmarshallingFailureException: Castor unmarshalling 
> exception; nested exception is org.exolab.castor.xml.MarshalException: 
> Illegal Text data found as child of: test_bean
>  value: "Mister Jones"{File: [not available]; line: 4; column: 13}
> org.springframework.oxm.UnmarshallingFailureException: Castor unmarshalling 
> exception; nested exception is org.exolab.castor.xml.MarshalException: 
> Illegal Text data found as child of: test_bean
>  value: "Mister Jones"{File: [not available]; line: 4; column: 13}
> 
> Any help?
> 
> -Henry
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>   http://xircles.codehaus.org/manage_email
> 
> 

Reply via email to