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) { while (true) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && parser.getName().equals("property")) { if (eventType == XmlPullParser.START_TAG && parser.getName().equals("property")) {
// Advance to name element. // Parse a property
parser.next(); boolean done = false;
// Depending on the server we may need to skip possible CRs String name = null;
String type = null;
String valueText = null;
Object value = null;
while (!done) {
eventType = parser.next(); eventType = parser.next();
String name; if (eventType == XmlPullParser.START_TAG) {
if (eventType == XmlPullParser.TEXT) { String elementName = parser.getName();
name = parser.getText(); String namespace = parser.getNamespace();
} if (elementName.equals("name")) {
else {
name = parser.nextText(); name = parser.nextText();
} }
parser.next(); else if (elementName.equals("value")) {
// Skip CRs type = parser.getAttributeValue("", "type");
parser.next(); valueText = parser.nextText();
String type = parser.getAttributeValue("", "type"); }
String valueText = parser.nextText(); }
Object value = null; else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("property")) {
if ("integer".equals(type)) { if ("integer".equals(type)) {
value = new Integer(valueText); value = new Integer(valueText);
} }
@ -795,6 +799,10 @@ class PacketReader {
if (name != null && value != null) { if (name != null && value != null) {
properties.put(name, value); properties.put(name, value);
} }
done = true;
}
}
}
} }
else if (eventType == XmlPullParser.END_TAG) { else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("properties")) { if (parser.getName().equals("properties")) {