diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-02-12 10:00:56 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-02-12 10:00:56 +0000 |
| commit | 4382a8afdb899e59ea8bff5caec7d70d4c64bcc6 (patch) | |
| tree | cb1736301e82c8ae165152fd0b385984531d70ec /source | |
| parent | 5a764007436eac8416a2d567bbc5e0a56ffc4240 (diff) | |
| download | qxmpp-4382a8afdb899e59ea8bff5caec7d70d4c64bcc6.tar.gz | |
* make it possible to test QXmppElement for nullity
* when parsing a QXmppElement, pick up the namespace
Diffstat (limited to 'source')
| -rw-r--r-- | source/QXmppElement.cpp | 9 | ||||
| -rw-r--r-- | source/QXmppElement.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/source/QXmppElement.cpp b/source/QXmppElement.cpp index 7dac43e6..a793a999 100644 --- a/source/QXmppElement.cpp +++ b/source/QXmppElement.cpp @@ -33,6 +33,10 @@ QXmppElement::QXmppElement() QXmppElement::QXmppElement(const QDomElement &element) { m_tagName = element.tagName(); + QString xmlns = element.namespaceURI(); + QString parentns = element.parentNode().namespaceURI(); + if (!xmlns.isEmpty() && xmlns != parentns) + m_attributes.insert("xmlns", xmlns); QDomNamedNodeMap attributes = element.attributes(); for (int i = 0; i < attributes.size(); i++) { @@ -73,6 +77,11 @@ void QXmppElement::setChildren(QList<QXmppElement> &children) m_children = children; } +bool QXmppElement::isNull() const +{ + return m_tagName.isEmpty(); +} + QString QXmppElement::tagName() const { return m_tagName; diff --git a/source/QXmppElement.h b/source/QXmppElement.h index 74f8150c..416487cb 100644 --- a/source/QXmppElement.h +++ b/source/QXmppElement.h @@ -47,6 +47,7 @@ public: QString tagName() const; void setTagName(const QString &type); + bool isNull() const; void toXml(QXmlStreamWriter *writer) const; private: |
