Qt allows multiple ways to parse XML data, including the common method that we covered in the previous examples. This time around, we're going to learn how to read data from an XML file using another class, called QDomDocument.
Processing XML data using the QDomDocument class
How to do it...
Processing XML data using the QDomDocument class is really simple:
- Add the XML module to the project by opening the project (.pro) file and adding the xml text after core and gui, as shown in the following code:
QT += core gui xml
- Create a user interface that carries a button that says Load XML:
- Right-click on the button, choose Go to slot…, and select the clicked() option. Press the OK button and Qt will add a slot function...