Home · All Classes · All Functions

QXmlPutGet Documentation


QXmlPutGet is a library for convenient and intuitive writing and reading of XML. This is a quick and more technical introduction to QXmlPutGet. For a practically oriented tutorial, visit



The library consists of two classes: writing is done by QXmlPut and reading by QXmlGet.

Both classes work on their current element. In QXmlPut this is the element that was previously created (e.g. with QXmlPut::putString), in QXmlGet this is the element which was previously navigated to (e.g. with QXmlGet::find). Due to this concept, writing and especially reading may not always happen in one single call, but multiple calls, that base on the internal state (the current element) of the QXmlPut/QXmlGet instance.

In QXmlPut the navigation is tied to the creation of tags (QXmlPut::putSingleTag, QXmlPut::putString, QXmlPut::descend,...).

In QXmlGet the navigation is done by finding tags by name (QXmlGet::find, QXmlGet::findNext), and possibly descending into them (QXmlGet::descend, QXmlGet::descended).

Both classes have functions that allow direct jumps inside the underlying QDomDocument (QXmlGet::goTo, QXmlPut::goTo, QXmlGet::element, QXmlPut::element). Use these functions only when necessary, as it's not the way normal linear navigation should be carried out.

In QXmlGet, once there is a current element available, it can be accessed e.g. with QXmlGet::getString, QXmlGet::getInt, QXmlGet::getAttributeString etc.

In QXmlPut, the current element (which was created with QXmlPut::putString("tagName", "string content"), for example), can further be modified by setting attributes, e.g. with QXmlPut::setAttributeString.