java - How to extract XML nested tags from Soap object? -


here requirement,

i getting response server soap object, converted string format, want extract xml data,

how can extract nested tags?

can extract data or need parse xml response? there way extract xml nested tags , parse arraylist<> post class?

<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body>     <maintag>     <item>       <name>androidpeople</name>        <website category="android">www.androidpeople.com</website>      </item>     <item>       <name>iphoneappdeveloper</name>        <website category="iphone">www.iphone-app-developer.com</website>        </item>     </maintag> .. 

if possible how?

thanks in advance.

i saw possible use , how

private static show getshowfromrss(context context, document feed,         string feedurl) {     try {         // there should 1 channel in feed, it.         // also, cast should okay if xml formatted correctly         nodelist item = feed.getelementsbytagname("channel");         element el = (element)item.item(0);          string title;         nodelist titlenode = el.getelementsbytagname("title");         if (titlenode == null || titlenode.getlength() < 1)             title = context.getstring(r.string.default_title);         else             title = titlenode.item(0).getfirstchild().getnodevalue();          string author;         nodelist authornode = el.getelementsbytagname("author");         if (authornode == null || authornode.getlength() < 1)             author = context.getstring(r.string.default_author);         else             author = authornode.item(0).getfirstchild().getnodevalue();          string desc;         nodelist descnode = el.getelementsbytagname("comments");         if (descnode == null || descnode.getlength() < 1)             desc = context.getstring(r.string.default_comments);         else             desc = descnode.item(0).getfirstchild().getnodevalue();          string imageurl;         nodelist imagnode = el.getelementsbytagname("image");         if(imagnode != null) {             element ima = (element)imagnode.item(0);             if (ima != null) {                 nodelist urlnode = ima.getelementsbytagname("url");                 if(urlnode == null || urlnode.getlength() < 1)                     imageurl = null;                 else                     imageurl =                         urlnode.item(0).getfirstchild().getnodevalue();             } else                 imageurl = null;         } else             imageurl = null;          return new show(title, author, feedurl, desc, imageurl, -1, -1);     } catch (exception e) {         // parse errors , we'll log , fail         log.e("ncrss", "error parsing rss", e);         return null;     } } 

you can use jaxb marshall/unmarshall soap packets. assume have schema soap packets have. check out - jaxb.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -