users@jaxb.java.net

serialized data in xml file

From: Filip Rindler <filip.rindler_at_gmx.de>
Date: Sat, 22 Mar 2003 12:27:12 +0100

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