From 4382a8afdb899e59ea8bff5caec7d70d4c64bcc6 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Fri, 12 Feb 2010 10:00:56 +0000 Subject: * make it possible to test QXmppElement for nullity * when parsing a QXmppElement, pick up the namespace --- source/QXmppElement.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/QXmppElement.cpp') 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 &children) m_children = children; } +bool QXmppElement::isNull() const +{ + return m_tagName.isEmpty(); +} + QString QXmppElement::tagName() const { return m_tagName; -- cgit v1.2.3