[prev in list] [next in list] [prev in thread] [next in thread] 

List:       castor-dev
Subject:    Re: [castor-dev] Mapping problem: Mapping XML content as text
From:       Keith Visco <kvisco () intalio ! com>
Date:       2003-06-27 19:12:54
[Download RAW message or body]


Carlos,

You'll need to specify your data in two possible formats to prevent the
XML parser from trying to parse those characters <A>...</A> as an
element. Specify them as character data as such:


<STACK>
<![CDATA[<A>a value</A><B>b value</B>]]>
</STACK>

-or-

<STACK>
&lt;A&gt;a value&lt;/A&gt;&lt;B&gt;b value&lt;/B&gt;
</STACK>

This will allow the first mapping you've specified below to work.

--Keith
 

Carlos Ruiz-Capillas wrote:
> 
> Hi!
> 
> I have this XML:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <DATA>
> <ID>2002780536178</ID>
> <DATA_ITEM>
> <CLASS>STACKDUMP</CLASS>
> <STACK>
> <A>a value</A><B>b value</B>
> </STACK>
> <DATA_ITEM>
> </DATA>
> 
> My problem is that I want to store the content of node STACK in a String variable \
> of a DataItemClass 
> Mapping 1 doesn´t work as I want ---> doesn't return <A>a value</A><B>b value</B> \
> as the content of this variable: 
> <class name="DataItemClass">
> <map-to xml="DATA_ITEM"/>
> <field name="Class" type="java.lang.String">
> <bind-xml name="CLASS" node="element"/>
> </field>
> 
> <field name="Stack"  type="java.lang.String">
> <bind-xml name="STACK" node="text"/>
> </field>
> </class>
> 
> And mapping 2 doesn't work well too:
> Mapping 1 don't return <A>a value</A><B>b value</B> as the content of this \
> variable: 
> <class name="DataItemClass">
> <map-to xml="DATA_ITEM"/>
> <field name="Class" type="java.lang.String">
> <bind-xml name="CLASS" node="element"/>
> </field>
> 
> <field name="Stack"  type="java.lang.String">
> <bind-xml name="STACK" node="element"/>
> </field>
> </class>
> ----------------------------------------
> 
> What is wrong? Is possible to do what I want? How?
> 
> Thanks!
> 
> Carlos.
> 
> _____________________________________
> Carlos Ruiz-Capillas Zarranz
> Software Engineer
> Newknow Network S.A.
> mailto: carlosrc@newknow.com
> Direct Phone: 91 639 89 50
> Main Phone: 91 639 90 00
> Fax: 91 638 71 59
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> minimalist@exolab.org with a subject of:
> unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
minimalist@exolab.org with a subject of:
        unsubscribe castor-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic