QDomDocument doc; if(doc.setContent(xmlStr)){ // assuming xmlStr is a QString containing XML structure QDomElement rootElem = doc.documentElement(); // get root element if(rootElem.isElement()){ // check if it's an element qDebug() << "Root node is an element"; } }
QDomElement elem = ...; // assume we have an element to process QDomNodeList children = elem.childNodes(); // get a list of all child nodes for(int i = 0; i < children.size(); i++){ QDomNode node = children.at(i); // get a child node if(node.isElement()){ // process only element nodes QDomElement childElem = node.toElement(); // do something with child element } }Package/Library: Qt Core library.