[jdom-interest] raw bytes turned into string and inserted into xml

Bart Read bart at wdi.co.uk
Mon Mar 18 07:29:51 PST 2002

Hi again Jeff,

Just had a little scout around and found a base 64 encoder / decoder on
Sourceforge, check out the following URL:



Bart Read
Senior Developer
Abbotsbury Software Ltd
Abbotsbury, DORSET DT3 4JT
Tel: +44 (0) 1305 871543
E-mail: bart at wdi.co.uk
----- Original Message -----
From: "Jeff Singer" <jeff.singer at vine.co.za>
To: <jdom-interest at jdom.org>
Sent: Monday, March 18, 2002 2:47 PM
Subject: [jdom-interest] raw bytes turned into string and inserted into xml

> Hi all,
> I have a situation in which my applications input is a raw stream of
> bytes, these bytes are actually ascii strings which occassionaly will
> contain characters which are illegal to xml like 0x4, 0x0, 0x1 - quite a
> few in this range. I use the string constructor which takes an encoding
> to form them into java.lang.String objects. This works fine, I then
> insert them as content onto a JDOM Element object and eventually after
> building up my document I use an XMLOutputter to convert the DOM to an
> XML string. This also works fine, where the problem lies is when the app
> that accepts the xml string I have generated tries to parse the xml. It
> throws JDOMException because the xml contains an invalid xml character
> in xml's that were created from byte streams which contained characters
> in the range already mentioned.
> Sample App attached
> Any help/ideas would be appreciated.
> Thanks in advance
> Jeff Singer

---------- Automatically inserted by WDI Mailserver ----------------
This message has been scanned for virus, trojans, illegal relays and
spam. If you have any comments, problems or questions please do not
hesitate to contact:
Abbotsbury Software Ltd
Tel: +44 1305 871543 Fax: +44 1305 871688
Email: postmaster at wdi.co.uk
Web: http://www.wdi.co.uk/virus.phtml

More information about the jdom-interest mailing list