DOM을 탐색하기 위해 QXml * 클래스를 신경 쓰지 않아도된다고 생각합니다.
QDomDocument 클래스에는 열린 QFile을 사용할 수있는 setContent() 메서드가 있습니다.
There's a code sample QDomDocument 설명서의 "자세히"절을 참조하십시오.
QDomDocument doc("mydocument");
QFile file("mydocument.xml");
if (!file.open(QIODevice::ReadOnly))
return;
if (!doc.setContent(&file)) {
file.close();
return;
}
file.close();
// print out the element names of all elements that are direct children
// of the outermost element.
QDomElement docElem = doc.documentElement();
QDomNode n = docElem.firstChild();
while(!n.isNull()) {
QDomElement e = n.toElement(); // try to convert the node to an element.
if(!e.isNull()) {
cout << qPrintable(e.tagName()) << endl; // the node really is an element.
}
n = n.nextSibling();
}