Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Base64 data

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Perry.Hoekstra AT mpls.frb.org
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Base64 data
  • Date: Wed, 7 Sep 2005 12:33:48 -0500

Hello all:

I am attempting to render an XML document received through a messaging
system into a Java object graph. My difficulty in an element that is
Base64 encoded. I paddled around through the XOM API and the samples but
could not figure a clear cut direction on how to render the element into a
byte[] array using XOM. My first assumption is to use the Serializer
class along the lines of the following psuedocode:

Element t_base64Element =
someParentElement.getFirstChildElement("base64Data");

ByteArrayOutputStream t_byteArrayOutputStream = new
ByteArrayOutputStream();

Serializer t_serializer = new Serializer(new ByteArrayOutputStream());

t_serializer.write(t_base64Element);

byte[] t_base64Data = t_byteArrayOutputStream.toByteArray();

However, the write() method is protected for Element. Am I way off base on
the proper use of the API or am I just missing a small piece?

Thank you,

Perry Hoekstra
>From mark.mascolino AT hp.com Wed Sep 7 13:52:12 2005
Return-Path: <mark.mascolino AT hp.com>
X-Original-To: xom-interest AT lists.ibiblio.org
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from ccerelbas01.cce.hp.com (ccerelbas01.cce.hp.com
[161.114.21.104])
by lists.ibiblio.org (Postfix) with ESMTP id 7F5AB4C00B
for <xom-interest AT lists.ibiblio.org>;
Wed, 7 Sep 2005 13:52:12 -0400 (EDT)
Received: from cceexg12.americas.cpqcorp.net (cceexg12.americas.cpqcorp.net
[16.81.1.38])
by ccerelbas01.cce.hp.com (Postfix) with ESMTP id B0D4A200004D;
Wed, 7 Sep 2005 12:52:08 -0500 (CDT)
Received: from cceexc14.americas.cpqcorp.net ([16.81.1.11]) by
cceexg12.americas.cpqcorp.net with Microsoft SMTPSVC(6.0.3790.211);
Wed, 7 Sep 2005 12:52:07 -0500
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Date: Wed, 7 Sep 2005 12:52:08 -0500
Message-ID:
<307F1DEF652C2E4C95428E27611FB228055AFE9A AT cceexc14.americas.cpqcorp.net>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: [XOM-interest] Base64 data
Thread-Index: AcWz0ljYV6fhpk2eQ3GpfhGA3Tko7wAAk4BQ
From: "Mascolino, Mark R." <mark.mascolino AT hp.com>
To: <Perry.Hoekstra AT mpls.frb.org>, <xom-interest AT lists.ibiblio.org>
X-OriginalArrivalTime: 07 Sep 2005 17:52:07.0811 (UTC)
FILETIME=[DD5B3D30:01C5B3D4]
Subject: Re: [XOM-interest] Base64 data
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.6
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Wed, 07 Sep 2005 17:52:12 -0000

> I am attempting to render an XML document received through a=20
> messaging system into a Java object graph. My difficulty in=20
> an element that is
> Base64 encoded. I paddled around through the XOM API and the=20
> samples but could not figure a clear cut direction on how to=20
> render the element into a byte[] array using XOM. My first=20
> assumption is to use the Serializer class along the lines of=20
> the following psuedocode:
>=20
> Element t_base64Element =3D
> someParentElement.getFirstChildElement("base64Data");

Isn't this as simple as:
byte[] content =3D t_base64Element.getValue().getBytes("US-ASCII");

mark




Archive powered by MHonArc 2.6.24.

Top of Page