Hello I am a new developer, in my app, I have had three editing text boxes, when the user fills the edit box. I want to see the data as an XML file.
That is, there are text box columns in the following: First name: _ lastName: _ _ DOB: _ ___ When the user fills the spaces as the first name: Shiva Last Name: Hybrid DOB: 0206 In fact, I want this data to be sent to a specific URL. & lt; Firstname & gt; Shiva & lt; / Firstname & gt; & Lt; Lastname & gt; Shankar & lt; / Lastname & gt; & Lt; Date of birth & gt; 0206 & lt; / Date of birth / gt; Anybody can help me do this ... What you're looking for is called the XML object serialize if you were looking to encode the generic object, the way you should follow Android Talk about the serialization on the peltform (unfortunately you can not use it on Android SDK). Given that you only need to serialize this object (I think?), You can avoid pain and create your own small serializer which generates your XML structure. Hope it helps. & lt; Usersdata & gt;
class UserObjectSerializer {map & lt; String, string & gt; Tag value = new map & lt; String, string & gt; (); Public UserObjectSerializer (user user) {tagValue ["firstname"] = user.getFirstname (); Tag value ["last name"] = user.getLastname (); Tag value ["db"] = user .getDob (); } Public printXml () {// browse your map and view your & lt; Keys & gt; Value & lt; / Keys & gt; Set key = tagValue.keySet (); Iterator = key.iterator (); While (this hasNext ()) {string tag = it.next (); String value = tag Value.get (key); System.out.println ("& lt;" + Tag + "& gt;" + value + "& lt; /" + Tag + "& gt;"); }}}
Comments
Post a Comment