This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes CreateElement / addChildNodes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "CreateElement / addChildNodes" Watch "CreateElement / addChildNodes" New topic

CreateElement / addChildNodes

Bram Maes
Ranch Hand

Joined: Sep 27, 2006
Posts: 32
Hi everyone,

My code looks like this :

What I see now is that alle the elements get separately added when I execute the createElement statements and they to the document while I only want the e1 element added (that has the other elements as children).

I'm sure there must be a simple way to do this but for the moment I don't see it. Can someone please help?


SCJP 5.0, SCEA part I
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12999
Try adding e1 to the Document right after creating it.

Bram Maes
Ranch Hand

Joined: Sep 27, 2006
Posts: 32
That did the trick indeed. This doesn't feel really naturally to me... Guess I'm the only one having this feeling

thanks a lot.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: CreateElement / addChildNodes
It's not a secret anymore!