| Author |
get java object and display in XML format
|
saket gupta
Greenhorn
Joined: Nov 09, 2004
Posts: 12
|
|
hi suppose we are storing all instance variable of class obj in HashMap using reflection and then we are iterating from HashMap and storing in XML format we are storing field type , field name and field value in hashmap and output like this <?xml version="1.0" encoding="UTF-8"?> <root class="One" label=VAR1/> <int name="int_One" >10</int> <String name="str_One" >One</String> <float name="float_one" >1.2</float> </root> what can i use for output like this ...... currently i m using StringBuffer for storing and printing in this way by hardcode like this for (int counter = 0; counter <= xmlfieldnames.size(); counter++) { if (xmlfieldnames.get("FieldName" + counter) != null) { xmlStrBuffer.append("\n<" + xmlfieldtype.get("FieldType" + counter) + " name=\"" + xmlfieldnames.get("FieldName" + counter) + "\" >" + xmlfieldvalue.get("FieldValue" + counter) + "</" + xmlfieldtype.get("FieldType" + counter) + ">"); } waiting for reply
|
 |
 |
|
|
subject: get java object and display in XML format
|
|
|