Processing XML data using stream reader
In this section, we will learn how to process data taken from an XML file and extract it using the stream reader.
How to do it…
Let's create a simple program that reads and processes XML files by following these steps:
- As usual, create a new Qt Widgets Application project at your desired location.
- Next, open up any text editor and create an XML file that looks like the following, then save it as
scene.xml:<?xml version="1.0" encoding="UTF-8"?> <scene> <object tag="building"> <name>Library</name> <position>120.0,0.0,50.68</position> <rotation>0.0,0.0,0.0</rotation> <scale>1.0,1.0,1.0</scale> </object> <object tag="building"> <name>Town Hall</name> <position>80.2,0.0,20.5</position> <rotation>0.0,0.0,0.0</rotation> <scale>1.0,1.0,1.0</scale>...
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime