android xml parsing of sub to subtag and store in hashmap -


hello new xml parsing

i have 1 xml this

 <tagmain>        <type>this data</type>        <sucesscodde>0</sucesscodde>        <sucesscoddemessage>success</sucesscoddemessage>        <anothersubtag>           <entry>              <number>1234567</number>              <mobileno>12345555555</mobileno>              <total>1.00</total>              <transactionstatus>success</transactionstatus>           </entry>              <entry>              <number>234555</number>              <mobileno>17777777</mobileno>              <total>1.00</total>              <transactionstatus>success</transactionstatus>           </entry> </anothersubtag> </tagmain> 

i have parse

 public hashmap<string, string> parse(final element e) {           hashmap<string, string> responsemap = new hashmap<string, string>();           string name="";             final nodelist children = e.getchildnodes();             (int = 0; < children.getlength(); i++) {                 final node n = children.item(i);                  if (n.getnodetype() == node.text_node) {                     system.out.println(n.gettextcontent()+" here!!!!!!!!");                  system.out.println("size !!!***"+responsemap.size());                 } else if (n.getnodetype() == node.element_node) {                     name=n.getnodename();                     system.out.print(n.getnodename() + " : ");                      parse((element) n);                     //responsemap.put(n.getnodename(), n.gettextcontent());                     //system.out.println(n.gettextcontent()+" here!!!!!!!!");                    }             }             return responsemap;         } 

parsing works... want store like<'number','123456'> <'number','123456'> tagname , value

or suggests other way

please help.. thanks..

you should use getattribute(string name) method

retrieves attribute value name.

parameters name
name of attribute retrieve.

returns

the attr value string, or empty string if attribute not have specified or default value.

for example, <entity number="134566">. call method @ element of <entity>


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -