List of utility methods to do XmlPullParser Read
String | readAttribute(XmlPullParser parser, String tag, String attributeName) read Attribute parser.require(XmlPullParser.START_TAG, NULL, tag);
String attributeData = parser
.getAttributeValue(NULL, attributeName);
parser.nextTag();
parser.require(XmlPullParser.END_TAG, NULL, tag);
return attributeData;
|
Bitmap | readBitmapAttribute(XmlPullParser in, String name) read Bitmap Attribute final byte[] value = readByteArrayAttribute(in, name); if (value != null) { return BitmapFactory.decodeByteArray(value, 0, value.length); } else { return null; |
Bitmap | readBitmapAttribute(XmlPullParser in, String name) read Bitmap Attribute final byte[] value = readByteArrayAttribute(in, name); if (value != null) { return BitmapFactory.decodeByteArray(value, 0, value.length); } else { return null; |
boolean | readBool(XmlPullParser parser, String tagName) Reads boolean from the next xml tag return readText(parser, tagName).equals("true"); |
boolean | readBooleanAttribute(XmlPullParser in, String name) read Boolean Attribute final String value = in.getAttributeValue(null, name); return Boolean.parseBoolean(value); |
boolean | readBooleanAttribute(XmlPullParser in, String name) read Boolean Attribute final String value = in.getAttributeValue(null, name); return Boolean.parseBoolean(value); |
boolean | readBooleanAttribute(XmlPullParser in, String name, boolean defaultValue) read Boolean Attribute final String value = in.getAttributeValue(null, name); if (value == null) { return defaultValue; } else { return Boolean.parseBoolean(value); |
byte[] | readByteArrayAttribute(XmlPullParser in, String name) read Byte Array Attribute final String value = in.getAttributeValue(null, name); if (value != null) { return Base64.decode(value, Base64.DEFAULT); } else { return null; |
Date | readDate(XmlPullParser parser, String tagName, String dateFormat) Reads a date from the next xml tag parser.require(XmlPullParser.START_TAG, NAMESPACE, tagName); Date date = null; SimpleDateFormat simpleDateFormat = new SimpleDateFormat( dateFormat, Locale.ENGLISH); if (parser.next() == XmlPullParser.TEXT) { try { date = simpleDateFormat.parse(parser.getText()); } catch (ParseException e) { ... |
float | readFloatAttribute(XmlPullParser in, String name) read Float Attribute final String value = in.getAttributeValue(null, name); try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new ProtocolException("problem parsing " + name + "=" + value + " as long"); |