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

first last <[email protected]>
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
Hi Jeff,Thanks for the quick respons. Are you suggesting that I do the
following?

org.apache.xmlbeans.xmlobject xmlObj = null;
...
create/populate the xmlObj
....
//directly typecast the xmlobj to Document
org.w3c.dom.Document nd = (Document) xmlObj.getDomNode();

Is this correct?

Regards,
Gugle



On Mon, Oct 5, 2009 at 2:50 PM, Jeff Lusted <[email protected]> wrote:

> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
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.