android - Parse all XML text using XMLPullParser -


i have question similar [this 1 here][1] have read tutorials xmlpullparser , not seem one.

i have xml tag want parse using xmlpullparser

<dt> : <sx>outcome</sx> <sx>result</sx> </dt> 

i want result ": outcome result." because reading xml online base. may change. instance :

<dt> :degree or measure of <d_link>succeeding</d_link> </dt> 

the question how parse , text in tag "dt" irrespective of name of tags in it?

this have tried not working.

while (parser.next() != end_tag){             if (parser.geteventtype() != text)             {                 continue;             }             else if (parser.geteventtype() == text)             {                 log.d("text", parser.gettext()+" in likelihood");                 stringbuilder.append(parser.gettext());                 parser.next();             }              } 

you should similar to:

while (eventtype != xmlpullparser.end_document)  {     string tagname = parser.getname();     switch (eventtype)      {         case xmlpullparser.start_tag:             if (tagname.equalsignorecase("dt"))              {                  // create new instance of dtclass                  dt= new dtclass();             }             break;          case xmlpullparser.text:              text = parser.gettext();              break;           case xmlpullparser.end_tag:              if (tagname.equalsignorecase("dt")) {                   // add dtclass object list                   dts.add(dt);              }               else if (tagname.equalsignorecase("sx"))               {                   dt.setsx(text);              }                break;           default:              break;      }      eventtype = parser.next(); } 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -