I have a problem when a try to create my dom tree.

In the constructor i build 2 objects:
Qt Code:
  1. QDomElement root=doc->createElement("root");
  2. doc->appendChild(root);
To copy to clipboard, switch view to plain text mode 

I'd like to fill the root node with some children and to have a structure like this:
Qt Code:
  1. <root>
  2. <node1>
  3. some text
  4. </node1>
  5. <node1>
  6. sometext
  7. </node2>
  8. </root>
To copy to clipboard, switch view to plain text mode 

To obtain this behaviour i make:
Qt Code:
  1. QDomElement ele=doc->createElement("node1");
  2. ele.appendChild(doc->createTextNode("some text");
  3. root.appendChild(ele);
To copy to clipboard, switch view to plain text mode 

To find a node element i make:
Qt Code:
  1. root.elementsByTagName("node1");
To copy to clipboard, switch view to plain text mode 

To clean the dom tree, a make:
Qt Code:
  1. root.clear();
To copy to clipboard, switch view to plain text mode 

What's wrang?? how can i obtain my behaviour???