users@jaxb.java.net

Re: serialized data in xml file

From: Robert Lowe <rmlowe_at_rmlowe.com>
Date: Sat, 22 Mar 2003 20:26:42 +0800

I haven't tried it, but Base64 encoding would probably work. Have a look at
sun.misc.BASE64Encoder and sun.misc.BASE64Decoder--these classes are
unsupported but ship with the J2SDK.



----- Original Message -----
From: "Filip Rindler" <filip.rindler_at_gmx.de>
To: <JAXB-INTEREST_at_JAVA.SUN.COM>
Sent: Saturday, March 22, 2003 7:27 PM
Subject: serialized data in xml file


> Hi!
>
> For my application i need the possibility to store arbitrary objects
> (implementing Serializable) as part of bigger data structures. I use JAXB
> for marshalling these data structures, however, I am having trouble saving
> the serial data of my objects into the XML file. I tried using a
> ObjectOutputStream which writes into a ByteArrayOutputStream which then
> converts its data to a string and puts this string into a (xsd:)string
> element (<serialdata>). Marshalling works just fine. However, when
> unmarshalling the XML file I always get a
>
> org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was
> found in the element content of the document.
>
> exception. Is there a way to save this serial data string into an XML file
> in a simple way? Actually, the system seems to convert some of characters
in
> the stream as I find things like "&#165;" in the serial data saved into my
> XML file.
>
> Thanks for your help!
>
> Fil