Chapter 15: Parsing XML

This chapter demonstrates three different ways to parse XML data: two available from Qt’s XML module, and a new, improved one from Qt’s core module. These examples show parse-event-driven parsing with SAX (the Simple API for XML), tree-style parsing with DOM (the Document Object Model), and stream-style parsing with QXmlStreamReader.

XML is an acronym for Extensible Markup Language. It is a markup language similar to HTML (Hypertext Markup Language), but with stricter syntax and no semantics (i.e., no meanings associated with the tags).

XML’s stricter syntax is in strong contrast to HTML. For example:

• Each XML <tag> must have a closing </tag>, or be self-closing, like this: <br/>.

• XML tags are case-sensitive: <tag> ...

Get Introduction to Design Patterns in C++ with Qt, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.