You're right, the makeElement method should have taken doc as the first
parameter.

I don't quite follow your second suggestion but I think it assumes a List
containing all elements anywhere in the tree? In the document you describe
the doc.content() will be a list of one element (<root>)

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Han Ming Ong" <[EMAIL PROTECTED]>
To: "James Strachan" <[EMAIL PROTECTED]>
Cc: "Dom4j-User" <[EMAIL PROTECTED]>
Sent: Thursday, February 06, 2003 6:49 PM
Subject: Re: [dom4j-user] Create Document...



On Thursday, February 6, 2003, at 12:59  AM, James Strachan wrote:

> There's a helper method available for this.
>
> Document doc = DocumentHelper.createDocument();
> Element page1 = DocumentHelper.makeElement("/root/pages/page1");

Sorry for the nitpick but I suppose you meant

Element page1 = DocumentHelper.makeElement(doc, "/root/pages/page1");

right?

It would be super cool if you can do something like the following
though:

Element page1 = DocumentHelper.makeElement("/root/pages/page1");

Element parent = ...
int pos = ... // get pos from convoluted algorithm somewhere
parent.content().add(pos, page1);

In this case, I can still use XPath to create element and have the
liberty to insert it anywhere.

Thanks for the good work, Han Ming

> Element page2 = DocumentHelper.makeElement("/root/pages/page2");
> Element page3 = DocumentHelper.makeElement("/root/pages/page3");
>
> James
> -------
> http://radio.weblogs.com/0112098/
> ----- Original Message -----
> From: "Hélder Sousa" <[EMAIL PROTECTED]>
> To: "Dom4j-User" <[EMAIL PROTECTED]>
> Sent: Monday, February 03, 2003 3:42 PM
> Subject: [dom4j-user] Create Document...
>
>
> Hi :)
> I would like to known if i can create a document from a specific xpath:
>
> "root/pages/page1"
> "root/pages/page2"
> "root/pages/page2"
>
> The document should represent the follow "tree":
> <root>
> <pages>
> <page1/>
> <page2/>
> <page3/>
> </pages>
> </root>
>
> This is possible?
> Tks
>
> Hélder Sousa
> Departamento de  Projectos e-Business
> I2S - Informática Sistemas e Serviços
> <<mailto:[EMAIL PROTECTED]>> - <<http://www.i2s.pt/>>
> Tel.: +351 22 834 04 00; Fax: +351 22 834 07 95
> Portugal
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld =omething 2 See!
> http://www.vasoftware.com
> _______________________________________________
> 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 email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld =omething 2 See!
http://www.vasoftware.com
_______________________________________________
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 email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to