Nick Stolwijk wrote:
> I have the following XML structure to work with:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <document>
>     <content>
>         <section>
>             <text>
>                 <html>
>                     <body>
>                         <p>This is a test<em>item.</em></p>
>                     </body>
>                 </html>
>             </text>
>             <subtitle>subtitel</subtitle>
>         </section>
>     </content>
> </document>
> 
> And a Java class with a property name 'text'. After unmarshalling I want 
> this property to contain all text within the body tag (so including the 
> elements). Do I need to write a custom unmarshaller for this or is there 
> already something which does this?
> 
> With regards,
> 
        Yes, you need to write a custom unmarhaller for this. We also tried to 
do exactly the same thing (embed a HTML document in the XML). This is 
actually relatively difficult. The deserilization process will  want to 
convert the "<" and ">" characters into their equivalent "&lt;" and "&gt;".

        I figured out how to do this at one point by writing by own custom 
(de)serializer, and modifying the JiBX code to skip the character 
conversion process. (you need to make one of the private write methods 
public to get around the conversion). But the code no longer works with 
the newer versions of JiBX, and we revered to leaving our HTML code in a 
CDATA section.
-- 
        Thomas Jones-Low            Softstart Services Inc.
        [EMAIL PROTECTED]      JobScheduler for Oracle
        Ph: 802-398-1012            http://www.softstart.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to