Working with the DOM Tree¶
DOM Level 2 is a W3C Recommendation for XML interfaces that maps the constituents of an XML document to a tree structure. The specification of DOM Level 2 can be found at http://www.w3.org/DOM/ .
Introduction to DOM¶
DOM provides an interface to access and change the content and structure of an XML file. It makes a hierarchical view of the document (a tree view). Thus – in contrast to the SAX2 interface – an object model of the document is resident in memory after parsing which makes manipulation easy.
Here are the available node classes and their potential child classes:
QDomNotation: No children
QDomNamedNodeMaptwo collection classes are provided:
QDomNodeListis a list of nodes, and
QDomNamedNodeMapis used to handle unordered sets of nodes (often used for attributes).
QDomImplementationclass allows the user to query features of the DOM implementation.
To get started please refer to the
QDomDocumentdocumentation. You might also want to take a look at the DOM Bookmarks Example , which illustrates how to read and write an XML bookmark file (XBEL) using DOM.
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.