mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-27 00:32:07 +01:00
Changes the way the properties are parsed.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2346 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
f7ccbe1421
commit
287c54a6ac
1 changed files with 52 additions and 44 deletions
|
@ -747,23 +747,27 @@ class PacketReader {
|
|||
while (true) {
|
||||
int eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG && parser.getName().equals("property")) {
|
||||
// Advance to name element.
|
||||
parser.next();
|
||||
// Depending on the server we may need to skip possible CRs
|
||||
// Parse a property
|
||||
boolean done = false;
|
||||
String name = null;
|
||||
String type = null;
|
||||
String valueText = null;
|
||||
Object value = null;
|
||||
while (!done) {
|
||||
eventType = parser.next();
|
||||
String name;
|
||||
if (eventType == XmlPullParser.TEXT) {
|
||||
name = parser.getText();
|
||||
}
|
||||
else {
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
String elementName = parser.getName();
|
||||
String namespace = parser.getNamespace();
|
||||
if (elementName.equals("name")) {
|
||||
name = parser.nextText();
|
||||
}
|
||||
parser.next();
|
||||
// Skip CRs
|
||||
parser.next();
|
||||
String type = parser.getAttributeValue("", "type");
|
||||
String valueText = parser.nextText();
|
||||
Object value = null;
|
||||
else if (elementName.equals("value")) {
|
||||
type = parser.getAttributeValue("", "type");
|
||||
valueText = parser.nextText();
|
||||
}
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
if (parser.getName().equals("property")) {
|
||||
if ("integer".equals(type)) {
|
||||
value = new Integer(valueText);
|
||||
}
|
||||
|
@ -795,6 +799,10 @@ class PacketReader {
|
|||
if (name != null && value != null) {
|
||||
properties.put(name, value);
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
if (parser.getName().equals("properties")) {
|
||||
|
|
Loading…
Reference in a new issue