QDomDocument doc; QDomElement root = doc.createElement("root"); doc.appendChild(root); QDomElement child1 = doc.createElement("child1"); root.appendChild(child1); QDomElement child2 = doc.createElement("child2"); root.appendChild(child2); QDomElement firstChild = root.firstChildElement(); qDebug() << firstChild.tagName(); // Output: "child1"In this example, we create a QDomDocument and append a root element to it. We then create two child elements and append them to the root element. Finally, we use the firstChildElement() method to retrieve the first child element of the root element and output its tag name. Package library: QtXml.