// create a new element with tag name "book" QDomElement bookElement = doc.createElement("book"); // add attributes to the element bookElement.setAttribute("id", "001"); bookElement.setAttribute("title", "The Great Gatsby"); bookElement.setAttribute("author", "F. Scott Fitzgerald");
// get the first child element of the "book" element QDomElement titleElement = bookElement.firstChildElement("title"); // get the text content of the title element QString title = titleElement.text();
// set the text content of the title element to "The Catcher in the Rye" titleElement.firstChild().setNodeValue("The Catcher in the Rye");This package/library is Qt.