public static final void writeValueXml(Object v,String name,XmlSerializer out) throws XmlPullParserException, IOException {
  String typeStr;
  if (v == null) {
    out.startTag(null,"null");
    if (name != null) {
      out.attribute(null,"name",name);
    }
    out.endTag(null,"null");
    return;
  }
 else   if (v instanceof String) {
    out.startTag(null,"string");
    if (name != null) {
      out.attribute(null,"name",name);
    }
    out.text(v.toString());
    out.endTag(null,"string");
    return;
  }
 else   if (v instanceof Integer) {
    typeStr="int";
  }
 else   if (v instanceof Long) {
    typeStr="long";
  }
 else   if (v instanceof Float) {
    typeStr="float";
  }
 else   if (v instanceof Double) {
    typeStr="double";
  }
 else   if (v instanceof Boolean) {
    typeStr="boolean";
  }
 else   if (v instanceof byte[]) {
    writeByteArrayXml((byte[])v,name,out);
    return;
  }
 else   if (v instanceof int[]) {
    writeIntArrayXml((int[])v,name,out);
    return;
  }
 else   if (v instanceof Map) {
    writeMapXml((Map)v,name,out);
    return;
  }
 else   if (v instanceof List) {
    writeListXml((List)v,name,out);
    return;
  }
 else   if (v instanceof CharSequence) {
    out.startTag(null,"string");
    if (name != null) {
      out.attribute(null,"name",name);
    }
    out.text(v.toString());
    out.endTag(null,"string");
    return;
  }
 else {
    throw new RuntimeException("writeValueXml: unable to write value " + v);
  }
  out.startTag(null,typeStr);
  if (name != null) {
    out.attribute(null,"name",name);
  }
  out.attribute(null,"value",v.toString());
  out.endTag(null,typeStr);
}

public static final void writeValueXml ( Object v , String name , XmlSerializer out ) throws XmlPullParserException , IOException { String typeStr ; if ( v == null ) { out . startTag ( null , "null" ) ; if ( name != null ) { out . attribute ( null , "name" , name ) ; } out . endTag ( null , "null" ) ; return ; } else if ( v instanceof String ) { out . startTag ( null , "string" ) ; if ( name != null ) { out . attribute ( null , "name" , name ) ; } out . text ( v . toString ( ) ) ; out . endTag ( null , "string" ) ; return ; } else if ( v instanceof Integer ) { typeStr = "int" ; } else if ( v instanceof Long ) { typeStr = "long" ; } else if ( v instanceof Float ) { typeStr = "float" ; } else if ( v instanceof Double ) { typeStr = "double" ; } else if ( v instanceof Boolean ) { typeStr = "boolean" ; } else if ( v instanceof byte [ ] ) { writeByteArrayXml ( ( byte [ ] ) v , name , out ) ; return ; } else if ( v instanceof int [ ] ) { writeIntArrayXml ( ( int [ ] ) v , name , out ) ; return ; } else if ( v instanceof Map ) { writeMapXml ( ( Map ) v , name , out ) ; return ; } else if ( v instanceof List ) { writeListXml ( ( List ) v , name , out ) ; return ; } else if ( v instanceof CharSequence ) { out . startTag ( null , "string" ) ; if ( name != null ) { out . attribute ( null , "name" , name ) ; } out . text ( v . toString ( ) ) ; out . endTag ( null , "string" ) ; return ; } else { throw new RuntimeException ( "writeValueXml: unable to write value " + v ) ; } out . startTag ( null , typeStr ) ; if ( name != null ) { out . attribute ( null , "name" , name ) ; } out . attribute ( null , "value" , v . toString ( ) ) ; out . endTag ( null , typeStr ) ; }
flatten an object ' s value into an xmlserializer . the value can later be read back with readthisvaluexml ( ) . < p / > currently supported value types are : null , string , integer , long , float , double boolean , map , list .
