aboutsummaryrefslogtreecommitdiff
path: root/source/QXmppElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/QXmppElement.cpp')
-rw-r--r--source/QXmppElement.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/QXmppElement.cpp b/source/QXmppElement.cpp
index 028770c0..09fa40e4 100644
--- a/source/QXmppElement.cpp
+++ b/source/QXmppElement.cpp
@@ -211,9 +211,13 @@ void QXmppElement::toXml(QXmlStreamWriter *writer) const
return;
writer->writeStartElement(d->name);
+ if (d->attributes.contains("xmlns"))
+ helperToXmlAddAttribute(writer, "xmlns", d->attributes.value("xmlns"));
foreach (const QString &attr, d->attributes.keys())
- helperToXmlAddAttribute(writer, attr, d->attributes.value(attr));
- writer->writeCharacters(d->value);
+ if (attr != "xmlns")
+ helperToXmlAddAttribute(writer, attr, d->attributes.value(attr));
+ if (!d->value.isEmpty())
+ writer->writeCharacters(d->value);
foreach (const QXmppElement &child, d->children)
child.toXml(writer);
writer->writeEndElement();