java - How to get a tag which is inside another one xml android -


this xml code, want items xml code.

the problem don't know how directly 'item' because u see 'item' 'channel': http://www.scarlett-fan.com/feed/

and part of java code

// initial eventtype     int eventtype = xpp.geteventtype();      // loop through pull events until reach end_document     while (eventtype != xmlpullparser.end_document) {         // current tag          string tagname = xpp.getname();           // react different event types appropriately         switch (eventtype) {         case xmlpullparser.start_tag:              if (tagname.equalsignorecase(key_site)) {                 // if starting new <site> block need                 //a new stacksite object represent                 curstacksite = new stacksite();             }             break;          case xmlpullparser.text:             //grab current text can use in end_tag event             curtext = xpp.gettext();             break;          case xmlpullparser.end_tag:               if (tagname.equalsignorecase(key_site)) {                 // if </site> done current site                 // add list.                 stacksites.add(curstacksite);             } else if (tagname.equalsignorecase(key_name)) {                 // if </name> use setname() on cursite                 curstacksite.setname(curtext);                 log.i("ghazi","ghazi"+curtext);             } else if (tagname.equalsignorecase(key_link)) {                 // if </link> use setlink() on cursite                 curstacksite.setlink(curtext);             } else if (tagname.equalsignorecase(key_about)) {                 // if </about> use setabout() on cursite                 curstacksite.setabout(curtext);             }             break;          default:             break;         }         //move on next iteration         eventtype = xpp.next();     } } catch (exception e) {     e.printstacktrace(); } 

    case xmlpullparser.start_tag:         // locate item         if (tagname.equalsignorecase("item")) {             // mark flag know we're in item             initem = true;             // create new item build             currentitem = new item();         } else if (initem && tagname.equalsignorecase("title")) {             // mark our current element know grab text             currentitemelement = itemelement.title;         }         break;     case xmlpullparser.text:         if (initem && currentitemelement == itemelement.title) {             // grab title text             currentitem.title = xpp.gettext();         }         break;     case xmlpullparser.end_tag: {         // check if finished item         if (initem && tagname.equalsignorecase("item")) {             // clear our flag tracking if we're in item             initem = false;             // add item whatever list of items we're building             items.add(currentitem);         } else {             currentitemelement = null;         }         break;  // ...  public enum itemelement {     title } 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -