// Assume "doc" is a QDomDocument object QDomNodeList nodeList = doc.elementsByTagNameNS("https://www.example.com", "myTag"); // Loop through the list of nodes and access their data for (int i = 0; i < nodeList.size(); i++) { QDomNode node = nodeList.at(i); QString data = node.firstChild().nodeValue(); // Access the node's text content // Do something with the data... }
// Assume "doc" is a QDomDocument object QDomNodeList nodeList = doc.elementsByTagNameNS("*", "myTag"); // Loop through the list of nodes and access their data for (int i = 0; i < nodeList.size(); i++) { QDomNode node = nodeList.at(i); QString data = node.firstChild().nodeValue(); // Access the node's text content // Do something with the data... }In this example, we are retrieving a list of all elements with the tag name "myTag" that are in any namespace. This is achieved by using "*" as the namespace URI parameter. We again loop through the retrieved nodes and access their text content.