Thanks, I thought that's what I did, and I kept getting a Elemetn
already has a DocumentElement error. Weird. But thanks, the explanation
makes perfect sense. 

Roshan Punnoose
Phone: 301-497-6039

-----Original Message-----
From: Eran Chinthaka [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 1:09 PM
To: [email protected]
Subject: Re: [Axis2] AXIOM XmlStreamReader

Punnoose, Roshan wrote:
> I have an XmlStreamReader and I want to get the OMElement from it and
> add it to another OMElement. However, since I am using the
> StAXOMBuilder, it always returns the XmlStreamReader contents as a
> OMElementImpl, and I can't add an OMElementImpl to another
> OMElementImpl. Is there anyway to get the XmlStreamReader as an
> OMNodeImpl instead?
Seems you have a slight misunderstanding. You should never see
OMElementImpl and/or OMNodeImpl classes and you should always work with
the factory and AXIOM api.

IIUC, you want to create an OMElement out of an XMLStreamReader and the
created OMElement to another OMElement. Here is how you can do it.

OMElement myOMElement = new
StAXOMBuilder(xmlStreamReaderInstance).getDocumentElement();
parentElement.addChild(myOMElement);

HTH.

-- Chinthaka


BEGIN:VCARD
VERSION:2.1
N:Punnoose;Roshan
FN:Punnoose, Roshan
ADR;WORK:;2115
LABEL;WORK:2115
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20050413T183207Z
END:VCARD
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to