}
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
boolean done = false;
StringBuilder buffer = null;
DataForm dataForm = new DataForm(parser.getAttributeValue("", "type"));
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("instructions")) {
dataForm.addInstruction(parser.nextText());
}
else if (parser.getName().equals("title")) {
dataForm.setTitle(parser.nextText());
}
else if (parser.getName().equals("field")) {
dataForm.addField(parseField(parser));
}
else if (parser.getName().equals("item")) {
dataForm.addItem(parseItem(parser));
}
else if (parser.getName().equals("reported")) {
dataForm.setReportedData(parseReported(parser));
}
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals(dataForm.getElementName())) {
done = true;
}
}
}
return dataForm;