I have a problem when a try to create my dom tree.
In the constructor i build 2 objects:
doc->appendChild(root);
QDomDocument *doc=new QDomDocument();
QDomElement root=doc->createElement("root");
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:
<root>
<node1>
some text
</node1>
<node1>
sometext
</node2>
</root>
<root>
<node1>
some text
</node1>
<node1>
sometext
</node2>
</root>
To copy to clipboard, switch view to plain text mode
To obtain this behaviour i make:
ele.appendChild(doc->createTextNode("some text");
root.appendChild(ele);
QDomElement ele=doc->createElement("node1");
ele.appendChild(doc->createTextNode("some text");
root.appendChild(ele);
To copy to clipboard, switch view to plain text mode
To find a node element i make:
root.elementsByTagName("node1");
root.elementsByTagName("node1");
To copy to clipboard, switch view to plain text mode
To clean the dom tree, a make:
root.clear();
root.clear();
To copy to clipboard, switch view to plain text mode
What's wrang?? how can i obtain my behaviour???
Bookmarks