mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-23 19:18:00 +01:00
f7a1c750ad
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11346 b35dd754-fafc-0310-a699-88a17e54d16e
35 lines
No EOL
825 B
Java
35 lines
No EOL
825 B
Java
/*
|
|
* Created on 2009-05-05
|
|
*/
|
|
package org.jivesoftware.smackx.pubsub;
|
|
|
|
import org.jivesoftware.smack.packet.PacketExtension;
|
|
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
|
|
public class CarExtensionProvider implements PacketExtensionProvider
|
|
{
|
|
|
|
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
|
|
{
|
|
String color = null;
|
|
int numTires = 0;
|
|
|
|
for (int i=0; i<2; i++)
|
|
{
|
|
while (parser.next() != XmlPullParser.START_TAG);
|
|
|
|
if (parser.getName().equals("paint"))
|
|
{
|
|
color = parser.getAttributeValue(0);
|
|
}
|
|
else
|
|
{
|
|
numTires = Integer.parseInt(parser.getAttributeValue(0));
|
|
}
|
|
}
|
|
while (parser.next() != XmlPullParser.END_TAG);
|
|
return new CarExtension(color, numTires);
|
|
}
|
|
|
|
} |