Is used to load and read from the XML document. More...
Public Functions | |
QXmlGet () | |
QXmlGet (QDomDocument document) | |
QXmlGet (const QXmlPut &xmlPut) | |
QDomDocument | document () const |
QString | docType () const |
QString | publicId () const |
QString | systemId () const |
QString | xmlDeclaration () const |
QString | xmlVersion () const |
QString | encoding () const |
bool | standalone () const |
bool | find (const QString &tagName) |
bool | findAndDescend (const QString &tagName) |
void | findReset () |
bool | findNext (const QString &tagName=QString()) |
bool | findNextAndDescend (const QString &tagName=QString()) |
int | childCount (const QString &tagName=QString()) const |
bool | hasChildren () const |
QString | tagName () const |
QString | getString (const QString &defaultValue=QString()) const |
QStringList | getStringList (const QStringList &defaultValue=QStringList()) |
int | getInt (int defaultValue=0) const |
QVector< int > | getIntVector (const QVector< int > &defaultValue=QVector< int >()) const |
double | getDouble (double defaultValue=0) const |
QVector< double > | getDoubleVector (const QVector< double > &defaultValue=QVector< double >()) const |
bool | getBool (bool defaultValue=false, QXmlPutGet::BoolFormats formats=QXmlPutGet::bfAll) const |
QVector< bool > | getBoolVector (const QVector< bool > &defaultValue=QVector< bool >(), QXmlPutGet::BoolFormats formats=QXmlPutGet::bfAll) const |
QColor | getColor (const QColor &defaultValue=QColor()) const |
QSize | getSize (const QSize &defaultValue=QSize()) const |
QSizeF | getSizeF (const QSizeF &defaultValue=QSizeF()) const |
QPoint | getPoint (const QPoint &defaultValue=QPoint()) const |
QPointF | getPointF (const QPointF &defaultValue=QPointF()) const |
QRect | getRect (const QRect &defaultValue=QRect()) const |
QRectF | getRectF (const QRectF &defaultValue=QRectF()) const |
QDate | getDate (const QDate &defaultValue=QDate()) const |
QTime | getTime (const QTime &defaultValue=QTime()) const |
QDateTime | getDateTime (const QDateTime &defaultValue=QDateTime()) const |
QByteArray | getByteArray (const QByteArray &defaultValue=QByteArray()) const |
QImage | getImage (const QImage &defaultValue=QImage()) const |
QPen | getPen (const QPen &defaultValue=QPen()) const |
QBrush | getBrush (const QBrush &defaultValue=QBrush()) const |
QFont | getFont (const QFont &defaultValue=QFont()) const |
bool | loadWidget (QWidget *w, bool warnWhenUnsupported=true) |
bool | loadWidgetsRecursive (QWidget *parent, const QString &prefix="", const QString &suffix="", const QSet< const QWidget *> &exclude=QSet< const QWidget *>()) |
bool | loadLineEdit (QLineEdit *w) |
bool | loadAbstractButton (QAbstractButton *w) |
bool | loadTextEdit (QTextEdit *w) |
bool | loadPlainTextEdit (QPlainTextEdit *w) |
bool | loadSpinBox (QSpinBox *w) |
bool | loadDoubleSpinBox (QDoubleSpinBox *w) |
bool | loadComboBox (QComboBox *w, bool items) |
bool | loadAbstractSlider (QAbstractSlider *w) |
bool | loadDateTimeEdit (QDateTimeEdit *w) |
bool | loadFontComboBox (QFontComboBox *w) |
bool | loadGroupBox (QGroupBox *w) |
bool | hasAttribute (const QString &name) const |
QString | getAttributeString (const QString &name, const QString &defaultValue=QString()) const |
int | getAttributeInt (const QString &name, int defaultValue=0) const |
QVector< int > | getAttributeIntVector (const QString &name, const QVector< int > &defaultValue=QVector< int >()) const |
double | getAttributeDouble (const QString &name, double defaultValue=0) const |
QVector< double > | getAttributeDoubleVector (const QString &name, const QVector< double > &defaultValue=QVector< double >()) const |
bool | getAttributeBool (const QString &name, bool defaultValue=false, QXmlPutGet::BoolFormats formats=QXmlPutGet::bfAll) const |
QVector< bool > | getAttributeBoolVector (const QString &name, const QVector< bool > &defaultValue=QVector< bool >(), QXmlPutGet::BoolFormats format=QXmlPutGet::bfAll) const |
QColor | getAttributeColor (const QString &name, const QColor &defaultValue=QColor()) const |
bool | fromString (const QString &str, QString *errorMessage=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr) |
bool | load (const QString &fileName, QString *errorMessage=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr) |
QXmlGet | restricted () |
void | descend () |
QXmlGet | descended () |
bool | rise () |
bool | goTo (QDomElement parentElement) |
QDomElement | element () const |
Is used to load and read from the XML document.
QXmlGet::QXmlGet | ( | ) |
Creates a QXmlGet instance with an empty document. Call fromString or load to conveniently load XML content to the document. If you have a QDomDocument ready, use the ructor instead.
QXmlGet::QXmlGet | ( | QDomDocument | document | ) |
This is an overloaded function.
Creates a QXmlGet instance from the passed QDomDocument. This instance can then read from the document.
QXmlGet::QXmlGet | ( | const QXmlPut & | xmlPut | ) |
|
inline |
Returns the QDomDocument this QXmlGet instance is using.
QString QXmlGet::docType | ( | ) | const |
Returns the doctype name.
example:
has the doctype "myDocType".
QString QXmlGet::publicId | ( | ) | const |
Returns the public identifier of the external DTD subset or an empty string if there is no public identifier.
example:
has the public identifier "myPublicId".
QString QXmlGet::systemId | ( | ) | const |
Returns the system identifier of the external DTD subset or an empty string if there is no system identifier.
example:
has the system identifier "mySystemId".
|
inline |
Returns the XML-Declaration (the tag name of the <? .. ?>
header), which always is "xml".
(Thus this function is rather redundant, but the DOM provides it, so it is provided here, too.)
|
inline |
Returns the xml version of the document. Typically this is "1.0" or "1.1".
example:
|
inline |
Returns the encoding of the document, e.g. "UTF-8".
example:
|
inline |
Returns the standalone-property of the document's xml declaration.
example:
has standalone false
has standalone true.
bool QXmlGet::find | ( | const QString & | tagName | ) |
Finds the first element named tagName in the current hierarchy level. If this returns true, an element was found. You then can access contents and attributes of this element via the get(...) functions.
For example, if you expect the element to contain a string as in
<element>Hellothere!</element>
call getString to retrieve "Hello there!".
If you expect the element to have further child elements and want to descend into their hierarchy level, call descend or descended.
If you expect more than one element with the name tagName in the current hierarchy level, consider using findNext instead, because find would always just find the first element.
bool QXmlGet::findAndDescend | ( | const QString & | tagName | ) |
Finds the first element with the specified tagName in the current hierarchy level and (if found) descends into it. If such an element is found, the function returns true. In that case you must make sure to call rise after the work in the lower hierarchy level is done.
If you expect more than one element with the name tagName in the current hierarchy level, consider using findNextAndDescend instead, because findAndDescend would always just find the first element.
void QXmlGet::findReset | ( | ) |
Resets the current element to the starting position (this means it will be pointing to the parent of the current hierarchy level). Any subsequent call to findNext or findNextAndDescend would start searching from the beginning. Calls to find are not affected, since it always starts searching from the beginning.
bool QXmlGet::findNext | ( | const QString & | tagName = QString() | ) |
finds the next element after the current element with tag name tagName.
Returns true when an element was found. This makes it possible to use it directly as a condition of a while-loop, looping over all elements with name tagName. If you want to descend into every such element, consider using findNextAndDescend.
Once no next element was found, the function returns false and the current element is reset. This means a subsequent call would restart the loop from the beginning, for example searching for a different tagName.
bool QXmlGet::findNextAndDescend | ( | const QString & | tagName = QString() | ) |
finds the next element after the current element with tag name tagName and descends into it.
Returns true when an element was found. This makes it possible to use it directly as a condition of a while-loop, looping over (and descending into) all elements with name tagName. Don't forget to call rise at the end of each iteration.
Once no next element was found, the function returns false and the current element is reset. This means a subsequent call would restart the loop from the beginning, for example searching for a different tagName.
int QXmlGet::childCount | ( | const QString & | tagName = QString() | ) | const |
Returns the number of elements with the specified tag name inside the current element. If tagName is empty, all elements are counted.
bool QXmlGet::hasChildren | ( | ) | const |
Returns whether the current element has children (sub elements). If so, you can call descend or descended to change into their hierarchy level to access them.
QString QXmlGet::tagName | ( | ) | const |
Returns the tag name of the current element.
For example, the element
<rect width="4">
has the tag name "rect".
QString QXmlGet::getString | ( | const QString & | defaultValue = QString() | ) | const |
Returns the string the current tag contains. If the current tag doesn't contain a string, defaultValue is returned.
QStringList QXmlGet::getStringList | ( | const QStringList & | defaultValue = QStringList() | ) |
Returns the string list the current tag contains. If the current tag doesn't contain a string list, defaultValue is returned.
int QXmlGet::getInt | ( | int | defaultValue = 0 | ) | const |
Returns the integer the current tag contains. If the current tag doesn't contain an integer, defaultValue is returned.
QVector< int > QXmlGet::getIntVector | ( | const QVector< int > & | defaultValue = QVector<int>() | ) | const |
Returns the integer vector the current tag contains. If the current tag doesn't contain an integer vector, defaultValue is returned.
double QXmlGet::getDouble | ( | double | defaultValue = 0 | ) | const |
Returns the double the current tag contains. If the current tag doesn't contain a double, defaultValue is returned.
QVector< double > QXmlGet::getDoubleVector | ( | const QVector< double > & | defaultValue = QVector<double>() | ) | const |
Returns the double vector the current tag contains. If the current tag doesn't contain a double vector, defaultValue is returned.
bool QXmlGet::getBool | ( | bool | defaultValue = false , |
QXmlPutGet::BoolFormats | formats = QXmlPutGet::bfAll |
||
) | const |
Returns the bool the current tag contains. If the current tag doesn't contain a bool, defaultValue is returned.
by setting formats, you may specify which boolean formats this function accepts.
QVector< bool > QXmlGet::getBoolVector | ( | const QVector< bool > & | defaultValue = QVector<bool>() , |
QXmlPutGet::BoolFormats | formats = QXmlPutGet::bfAll |
||
) | const |
Returns the bool vector the current tag contains. If the current tag doesn't contain a bool vector, defaultValue is returned.
by setting formats, you may specify which boolean formats this function accepts.
QColor QXmlGet::getColor | ( | const QColor & | defaultValue = QColor() | ) | const |
Returns the QColor the current tag contains. If the current tag doesn't contain a QColor, defaultValue is returned.
QSize QXmlGet::getSize | ( | const QSize & | defaultValue = QSize() | ) | const |
Returns the QSize the current tag contains. If the current tag doesn't contain a QSize, defaultValue is returned.
QSizeF QXmlGet::getSizeF | ( | const QSizeF & | defaultValue = QSizeF() | ) | const |
Returns the QSizeF the current tag contains. If the current tag doesn't contain a QSizeF, defaultValue is returned.
QPoint QXmlGet::getPoint | ( | const QPoint & | defaultValue = QPoint() | ) | const |
Returns the QPoint the current tag contains. If the current tag doesn't contain a QPoint, defaultValue is returned.
QPointF QXmlGet::getPointF | ( | const QPointF & | defaultValue = QPointF() | ) | const |
Returns the QPointF the current tag contains. If the current tag doesn't contain a QPointF, defaultValue is returned.
QRect QXmlGet::getRect | ( | const QRect & | defaultValue = QRect() | ) | const |
Returns the QRect the current tag contains. If the current tag doesn't contain a QRect, defaultValue is returned.
QRectF QXmlGet::getRectF | ( | const QRectF & | defaultValue = QRectF() | ) | const |
Returns the QRectF the current tag contains. If the current tag doesn't contain a QRectF, defaultValue is returned.
QDate QXmlGet::getDate | ( | const QDate & | defaultValue = QDate() | ) | const |
Returns the QDate the current tag contains. If the current tag doesn't contain a QDate, defaultValue is returned.
QTime QXmlGet::getTime | ( | const QTime & | defaultValue = QTime() | ) | const |
Returns the QTime the current tag contains. If the current tag doesn't contain a QTime, defaultValue is returned.
QDateTime QXmlGet::getDateTime | ( | const QDateTime & | defaultValue = QDateTime() | ) | const |
QByteArray QXmlGet::getByteArray | ( | const QByteArray & | defaultValue = QByteArray() | ) | const |
Returns the QByteArray the current tag contains. If the current tag doesn't contain a QByteArray, defaultValue is returned.
QImage QXmlGet::getImage | ( | const QImage & | defaultValue = QImage() | ) | const |
Returns the QImage the current tag contains. If the current tag doesn't contain a QImage, defaultValue is returned.
QPen QXmlGet::getPen | ( | const QPen & | defaultValue = QPen() | ) | const |
Returns the QPen the current tag contains. If the current tag doesn't contain a QPen, defaultValue is returned.
QBrush QXmlGet::getBrush | ( | const QBrush & | defaultValue = QBrush() | ) | const |
Returns the QBrush the current tag contains. If the current tag doesn't contain a QBrush, defaultValue is returned.
QFont QXmlGet::getFont | ( | const QFont & | defaultValue = QFont() | ) | const |
Returns the QFont the current tag contains. If the current tag doesn't contain a QFont, defaultValue is returned.
bool QXmlGet::loadWidget | ( | QWidget * | w, |
bool | warnWhenUnsupported = true |
||
) |
Loads the state of the passed widget w from anywhere inside the current parent xml tag. The xml data must have previously been created via the QXmlPut::saveWidget method, or any of the specialized widget saving methods such as QXmlPut::saveLineEdit or QXmlPut::saveSpinBox, etc.
If warnWhenUnsupported is set to true, a qDebug() output is issued when w is of an unsupported widget type.
Returns false if the widget w is a supported widget but couldn't be found/loaded under this xml tag. Therefore it returns true if the widget was either loaded successfully or it is an unsupported widget. This behavior allows successively calling loadWidget on a group of widgets possibly containing unsupported widgets and only catching load errors if the widget should in principle be available in the xml (see loadWidgetsRecursive).
Supported widget types are: QLineEdit, QAbstractButton (and subclasses such as QCheckBox and QRadioButton), QTextEdit, QPlainTextEdit, QSpinBox, QDoubleSpinBox, QComboBox, QAbstractSlider (and subclasses such as QScrollBar and QSlider), QDateTimeEdit (and subclasses such as QTimeEdit and QDateEdit), QFontComboBox, QGroupBox.
bool QXmlGet::loadWidgetsRecursive | ( | QWidget * | parent, |
const QString & | prefix = "" , |
||
const QString & | suffix = "" , |
||
const QSet< const QWidget *> & | exclude = QSet<const QWidget*>() |
||
) |
Loads the widget passed as parent from xml, as well as all direct and indirect child widgets that are supported by QXmlPutGet.
If prefix and/or suffix are provided, only widgets that have the according prefix and/or suffix in their object name are considered. This is useful for marking a specific subset of widgets for xml storage already during UI design. Further, any widgets specified in exclude are not considered.
Returns whether all widgets were loaded successfully. If false is returned, at least one widget that should have been saved with an according call to QXmlPut::saveWidgetsRecursive (with the same parameters) couldn't be found/loaded.
bool QXmlGet::loadLineEdit | ( | QLineEdit * | w | ) |
Loads the state of the passed QLineEdit w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveLineEdit method.
The line edit's text value is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadAbstractButton | ( | QAbstractButton * | w | ) |
Loads the state of the passed QAbstractButton w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveAbstractButton method.
The button's checked state is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadTextEdit | ( | QTextEdit * | w | ) |
Loads the state of the passed QTextEdit w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveTextEdit method.
The text edit's content is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadPlainTextEdit | ( | QPlainTextEdit * | w | ) |
Loads the state of the passed QPlainTextEdit w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::savePlainTextEdit method.
The text edit's content is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadSpinBox | ( | QSpinBox * | w | ) |
Loads the state of the passed QSpinBox w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveSpinBox method.
The spin box value is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadDoubleSpinBox | ( | QDoubleSpinBox * | w | ) |
Loads the state of the passed QDoubleSpinBox w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveDoubleSpinBox method.
The spin box value is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadComboBox | ( | QComboBox * | w, |
bool | items | ||
) |
Loads the state of the passed QComboBox w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveComboBox method.
The combo box selection state/text is retrieved from the xml entry. If items is set to true, the items themselves are retrieved from the xml entry, too. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadAbstractSlider | ( | QAbstractSlider * | w | ) |
Loads the state of the passed QAbstractSlider w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveAbstractSlider method.
The slider value is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadDateTimeEdit | ( | QDateTimeEdit * | w | ) |
Loads the state of the passed QDateTimeEdit w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveDateTimeEdit method.
The edit's date/time is retrieved from the xml entry. Note that this method can also handle subclasses QDateEdit and QTimeEdit. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadFontComboBox | ( | QFontComboBox * | w | ) |
Loads the state of the passed QFontComboBox w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveFontComboBox method.
The font combo box selected font descriptor (family, size, weight, etc.) is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::loadGroupBox | ( | QGroupBox * | w | ) |
Loads the state of the passed QGroupBox w from anywhere inside the current parent xml tag. The xml data must have previously been created via the corresponding QXmlPut::saveGroupBox method.
If the group box is checkable, its checked state is retrieved from the xml entry. Returns true if loading was successful.
Consider using loadWidget as a more convenient alternative, since the type of the widget is inferred automatically.
bool QXmlGet::hasAttribute | ( | const QString & | name | ) | const |
Returns whether the current tag has an attribute with the name name.
QString QXmlGet::getAttributeString | ( | const QString & | name, |
const QString & | defaultValue = QString() |
||
) | const |
Returns the string the current tag carries as attribute with the name name. If the current tag doesn't contain such an attribute,defaultValue is returned.
int QXmlGet::getAttributeInt | ( | const QString & | name, |
int | defaultValue = 0 |
||
) | const |
Returns the integer the current tag carries as attribute with the name name. If the current tag doesn't contain such an attribute,defaultValue is returned.
QVector< int > QXmlGet::getAttributeIntVector | ( | const QString & | name, |
const QVector< int > & | defaultValue = QVector<int>() |
||
) | const |
Returns the integer vector the current tag carries as attribute with the name name. If the current tag doesn't contain such an attribute,defaultValue is returned.
double QXmlGet::getAttributeDouble | ( | const QString & | name, |
double | defaultValue = 0 |
||
) | const |
Returns the double the current tag carries as attribute with the name name. If the current tag doesn't contain such an attribute,defaultValue is returned.
QVector< double > QXmlGet::getAttributeDoubleVector | ( | const QString & | name, |
const QVector< double > & | defaultValue = QVector<double>() |
||
) | const |
Returns the double vector the current tag carries as attribute with the name name. If the current tag doesn't contain such an attribute,defaultValue is returned.
bool QXmlGet::getAttributeBool | ( | const QString & | name, |
bool | defaultValue = false , |
||
QXmlPutGet::BoolFormats | formats = QXmlPutGet::bfAll |
||
) | const |
Returns the bool the current tag carries as attribute with the name name. If the current tag doesn't contain such an attribute,defaultValue is returned.
by setting formats, you may specify which boolean formats this function accepts.
QVector< bool > QXmlGet::getAttributeBoolVector | ( | const QString & | name, |
const QVector< bool > & | defaultValue = QVector<bool>() , |
||
QXmlPutGet::BoolFormats | formats = QXmlPutGet::bfAll |
||
) | const |
Returns the bool vector the current tag carries as attribute with the name name. If the current tag doesn't contain such an attribute,defaultValue is returned.
by setting formats, you may specify which boolean formats this function accepts.
QColor QXmlGet::getAttributeColor | ( | const QString & | name, |
const QColor & | defaultValue = QColor() |
||
) | const |
Returns the QColor the current tag carries as attribute with the name name. If the current tag doesn't contain such an attribute,defaultValue is returned.
bool QXmlGet::fromString | ( | const QString & | str, |
QString * | errorMessage = nullptr , |
||
int * | errorLine = nullptr , |
||
int * | errorColumn = nullptr |
||
) |
Loads the XML content from the string str into this QXmlGet instance. Returns true on success.
If the provided markup contains errors, this function returns false and outputs the error message in errorMessage and the location of the error in errorLine and errorColumn.
bool QXmlGet::load | ( | const QString & | fileName, |
QString * | errorMessage = nullptr , |
||
int * | errorLine = nullptr , |
||
int * | errorColumn = nullptr |
||
) |
Loads the XML content from the file fileName into this QXmlGet instance. Returns true on success.
If the provided markup contains errors, this function returns false and outputs the error message in errorMessage and the location of the error in errorLine and errorColumn.
If the provided file can't be opened (e.g. because it doesn't exist or the application doesn't have read permission), this function returns false and errorMessage, errorLine and errorColumn are left unchanged.
QXmlGet QXmlGet::restricted | ( | ) |
Returns a QXmlGet instance on the same Document and at the same position as this instance, but which is restricted to this hierarchy level (and the levels below). This means, the returned QXmlGet instance isn't allowed to rise above the current hierarchy level.
This is useful if you wish that subroutines can handle their own XML work without possibly interfering with the rest. By passing a restricted instance, it's guaranteed the subroutines don't accidentally write/read outside their designated XML element.
If only the subroutine needs to write to/read from a specific element, consider using descended.
example:
void QXmlGet::descend | ( | ) |
Descends into the current element. Child elements can then be accessed normally via find etc.
Once the work in the lower hierarchy level is done, you can return to the previous position in the parent hierarchy level by calling rise.
If a subroutine needs to write to/read from a specific element, consider using descended instead of a descend-rise-pair.
example:
QXmlGet QXmlGet::descended | ( | ) |
Returns a QXmlGet instance that is descended into and restricted to the current element. Child elements can then be accessed with the returned instance normally via find etc.
Due to the restriction, the returned instance can't rise above its initial hierarchy level, i.e. into or above the hierarchy level of the instance this function is called on.
When descending into elements like this, there is no need to call rise (and thus no possibility to forget a rise), because the current instance isn't influenced. Whatever descending/rising the subroutine does with the returned instance can't break the callers XML handling code.
example:
bool QXmlGet::rise | ( | ) |
Rises to the previous position in the parent hierarchy level. This finishes the work in a lower hierarchy level that was started with descend earlier.
If a subroutine needs to write to/read from a specific element, consider using descended instead of a descend-rise-pair.
If this instance is restricted (see descended and restricted) and is already inside its highest allowed hierarchy level, a further attempt to rise will return false without changing the current hierarchy level, and cause a corresponding qDebug output.
example:
bool QXmlGet::goTo | ( | QDomElement | parentElement | ) |
Changes the current parent element to parentElement. It must be in the current QDomDocument already.
If this instance is restricted (see descended and restricted) and parentElement is not inside the allowed hierarchy, this function will return false without changing the current position, and cause a corresponding qDebug output.
You probably won't use this function very often, since normal, linear QXmlPutGet navigation should be done with find, descend, rise, descended, etc. However, it's useful for nonlinear XML navigation, where frequent jumps between different locations in the XML hierarchy need to be done.
|
inline |
Returns the current element as a QDomElement. This can be used as a jump target for goTo, or some low-level manipulation of the node with the Qt-DOM-interface.