Re: How to convert from org.apache.xmlbeans.xmlobject to org.w3c.dom.Document?

Jeff Lusted <[email protected]>
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
Hi Gugle!

On Mon, 2009-10-05 at 14:03 +0530, first last wrote:
> Hi all,
> I'm using XMLBeans to create an XML object which is of
> type org.apache.xmlbeans.xmlobject. But I need to pass this XML
> content to an API which expects an XML of type - org.w3c.dom.Document.
> Does XMLBeans provide a direct way of converting from xmlobject to
> dom.Document? I noticed that we can go from XmlObject to org.w3c.dom
> Node Object using XmlObject.newDomNode(), but not sure how to get a
> dom.Document object from XMLobject. Can someone let me know if this is
> possible?

My understanding is that if you use the XmlObject that is the equivalent
of the document interface, then yourXmlObject.getDomNode() should return
the correct Dom Node and this used tocast to a org.w3c.dom.Document...

>From the api...

> public Node getDomNode()
> 
> 
> Returns a W3C DOM Node containing the XML represented by this source.
> This is a live DOM node, not a copy. Any changes made through this
> node are immediately reflected in the document associated with this
> token source. Depending on the kind of token this XmlTokenSource
> represents, an appropriate node will be returned. 

Haven't tried this any time recently. Hope my understanding is good.
Regards
Jeff
-- 
Jeff Lusted               tel: +44 (0)116 252 3581
Astrogrid Project         mob: +44 (0)7941 599062
Dept Physics & Astronomy  email: [email protected]
University of Leicester   web: http://www.astrogrid.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.