[ fromfile: xml-dom.xml id: xml-dom ]
The Document Object Model (DOM) is a higher-level interface for operating on XML documents. Working with and navigating through DOM documents is straightforward (especially if you are familiar with QObject children).
The main classes in DOM are shown in Figure 15.3.
The function setContent()
parses the file, after which the QDomDocument contains a structured tree consisting of QDomNode objects.
Each QDomNode could be an instance of QDomElement, QDomAttr, or QDomText.
Every QDomNode has a parent except the root, which is a QDomDocument.
Every node is reachable from the parent.
DOM is another application of the Composite pattern.
Note | |
---|---|
The QDom classes are wrappers around private implementation classes. They contain no data except a pointer. This makes it possible to pass around |
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |