What is the xml root element? The first tag except the “<?xml version=”1.0″ encoding=”ISO-8859-1″?>” and the <!DOCTYPE …> is the root element. How to get the xml document root in Qt? Use dom.documentElement(). How to get the text in between the opening tag and the closing tag? If ele is the QDomElement for the tag, the simplest way to get the text is ele.text(). An alternative method is using QDomNode::nodeValue() as an element is also a node. But do not use ele.nodeValue(),which returns an empty string because only the QDomNode of a QDomText element can return its text. So the correct way is ele.firstChild().nodeValue(). ele.firstChild() returns the QDomText object representing the text.
Comments are closed, but trackbacks and pingbacks are open.