Commit 6d1ed2ce authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Don't include namespaces "jabber:client", "jabber:server" or "jabber:component:accept". JM-6


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1370 b35dd754-fafc-0310-a699-88a17e54d16e
parent dabfef94
...@@ -313,34 +313,38 @@ public class XPPPacketReader { ...@@ -313,34 +313,38 @@ public class XPPPacketReader {
return document; return document;
} }
case XmlPullParser.START_TAG: { case XmlPullParser.START_TAG: {
QName qname = (pp.getPrefix() == null) ? df.createQName(pp.getName(), pp.getNamespace()) : df.createQName(pp.getName(), pp.getPrefix(), pp.getNamespace()); QName qname = (pp.getPrefix() == null) ? df.createQName(pp.getName(), pp.getNamespace()) : df.createQName(pp.getName(), pp.getPrefix(), pp.getNamespace());
Element newElement = null; Element newElement = null;
if ("jabber:client".equals(qname.getNamespaceURI())) { // Do not include the namespace if this is the start tag of a new packet
newElement = df.createElement(pp.getName()); // This avoids including "jabber:client", "jabber:server" or
} // "jabber:component:accept"
else { if ("jabber:client".equals(qname.getNamespaceURI()) ||
newElement = df.createElement(qname); "jabber:server".equals(qname.getNamespaceURI()) ||
} "jabber:component:accept".equals(qname.getNamespaceURI())) {
// Element newElement = DocumentHelper.createElement(pp.getName()); newElement = df.createElement(pp.getName());
int nsStart = pp.getNamespaceCount(pp.getDepth() - 1); }
int nsEnd = pp.getNamespaceCount(pp.getDepth()); else {
for (int i = nsStart; i < nsEnd; i++) newElement = df.createElement(qname);
if (pp.getNamespacePrefix(i) != null)
newElement.addNamespace(pp.getNamespacePrefix(i), pp.getNamespaceUri(i));
for (int i = 0; i < pp.getAttributeCount(); i++) {
QName qa = (pp.getAttributePrefix(i) == null) ? df.createQName(pp.getAttributeName(i)) : df.createQName(pp.getAttributeName(i), pp.getAttributePrefix(i), pp.getAttributeNamespace(i));
newElement.addAttribute(qa, pp.getAttributeValue(i));
}
if (parent != null) {
parent.add(newElement);
}
else {
document.add(newElement);
}
parent = newElement;
count++;
break;
} }
int nsStart = pp.getNamespaceCount(pp.getDepth() - 1);
int nsEnd = pp.getNamespaceCount(pp.getDepth());
for (int i = nsStart; i < nsEnd; i++)
if (pp.getNamespacePrefix(i) != null)
newElement.addNamespace(pp.getNamespacePrefix(i), pp.getNamespaceUri(i));
for (int i = 0; i < pp.getAttributeCount(); i++) {
QName qa = (pp.getAttributePrefix(i) == null) ? df.createQName(pp.getAttributeName(i)) : df.createQName(pp.getAttributeName(i), pp.getAttributePrefix(i), pp.getAttributeNamespace(i));
newElement.addAttribute(qa, pp.getAttributeValue(i));
}
if (parent != null) {
parent.add(newElement);
}
else {
document.add(newElement);
}
parent = newElement;
count++;
break;
}
case XmlPullParser.END_TAG: { case XmlPullParser.END_TAG: {
if (parent != null) { if (parent != null) {
parent = parent.getParent(); parent = parent.getParent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment