Code example for XmlPullParser

Methods: getAttributeValue, nextText

0
        this.key = value;
    } 
 
	@Override 
	public void init(XmlPullParser parser) throws IOException, XmlPullParserException {
		setKey(parser.getAttributeValue(null, "key"));
		setValue(Long.parseLong(parser.nextText()));
	} 
 
	@Override 
	public void toXml(XmlSerializer serializer) throws IOException {
		XmlSerializer element = serializer.startTag(null, "property");
		XppUtils.setAttributeValueToNode(element, "key", getKey());
		XppUtils.setElementValue(element, getValue());
		serializer.endTag(null, "property");
	} 
 
}