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


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to