1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-23 11:07:57 +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:
Gaston Dombiak 2004-07-17 17:50:18 +00:00 committed by gdombiak
parent f7ccbe1421
commit 287c54a6ac

View file

@ -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")) {