dreamer
7th May 2008, 15:56
I have a problem when a try to create my dom tree.
In the constructor i build 2 objects:
QDomDocument *doc=new QDomDocument();
QDomElement root=doc->createElement("root");
doc->appendChild(root);
I'd like to fill the root node with some children and to have a structure like this:
<root>
<node1>
some text
</node1>
<node1>
sometext
</node2>
</root>
To obtain this behaviour i make:
QDomElement ele=doc->createElement("node1");
ele.appendChild(doc->createTextNode("some text");
root.appendChild(ele);
To find a node element i make:
root.elementsByTagName("node1");
To clean the dom tree, a make:
root.clear();
What's wrang?? how can i obtain my behaviour???
In the constructor i build 2 objects:
QDomDocument *doc=new QDomDocument();
QDomElement root=doc->createElement("root");
doc->appendChild(root);
I'd like to fill the root node with some children and to have a structure like this:
<root>
<node1>
some text
</node1>
<node1>
sometext
</node2>
</root>
To obtain this behaviour i make:
QDomElement ele=doc->createElement("node1");
ele.appendChild(doc->createTextNode("some text");
root.appendChild(ele);
To find a node element i make:
root.elementsByTagName("node1");
To clean the dom tree, a make:
root.clear();
What's wrang?? how can i obtain my behaviour???