It depends what your Node is. If it already is a Document then its just a
cast. If its an Element then you can create a document and it can be the
single root element.

Node node = ...;
Element root = (Element) node;
Document document = DocumentHelper.createDocument( root );

If its something else (an Attribute, Text node etc) then you'll need to
create an Element to put it in first.

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Gary Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 21, 2002 7:09 PM
Subject: [dom4j-user] Creating a Document from a Node


> I would like to be able create a Document object from a Node object.
>
> I tried using node.GetDocument() but this retrieves the parent Document.
> How can I efficiently create a new Document from a Node?
>
> Thanks
> G
>
>
>
> -------------------------------------------------------
> This sf.net emial is sponsored by: Influence the future
> of  Java(TM) technology. Join the Java Community
> Process(SM) (JCP(SM)) program now.
>
http://ad.doubleclick.net/clk;4699841;7576298;k?http://www.sun.com/javavote
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to