android - getting the rel="alternate" href value from xml feed using java DocumentBuilder -


Need help ... to ensure that it will look like a dumb question to experienced XML developers < / P>

I am trying to read the following feed:

Using inputstream and document to explore XML

such as: document Dom = db.parse (in);

How the entry elemet looks like this:

   & Lt; link rel = "self" type = "application / atom + xml" href = "http://www.blogger.com/feeds/7793856/posts/default/7139617615025474381" /> & Lt; Link rel = "alternate" type = "text / html" href = "http://orangette.blogspot.com/2011/03/its-called-pantry.html" title = "it is called a pantry" /> ; & Lt; Author & gt; & Lt; Name & gt; Molly & lt; / Name & gt; & Lt; Uri & gt; Http: //www.blogger.com/profile/01493708300940204826< / Uri & gt; & Lt; Email & gt; Cheeseandchocolate@gmail.com< / Email & gt; & Lt; Gd: extended property xmlns: gd = "http://schemas.google.com/g/2005" name = "OpenSocialUserId" value = "07818414465072164731" /> & Lt; / Author & gt; & Lt; Media: thumbnail xmlns: media = "http://search.yahoo.com/mrss/" url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEMyOIc3lrx3IhkBSIGjAXt9_eDP155XdScQGtHtMaza_PFuvBOJrEjGMAuZCzDkqqCwHSgWMBY8zYZnw8APEp13tj0y6X8fjOrzT6Xor-6q0BH7dghpz72q5J8Pl_fbWM0rGFSoQeiw/ / 5544384475_858400a1f7_z .jpg "height =" 72 "width =" 72 "/> & Lt; Thr: Total & gt; 163 & lt; / Thr: Total & gt; & Lt; / Entry & gt;   

All are working well in addition to taking and getting the same Reliance <<>

An optional relay is the relevant one in this case

  & lt; Link rel = "alternate" type = "text / html" href = "http://orangette.blogspot.com/2011/03/its-called pantry.html" title = "it is called pantry" & gt;   

He wasted many hours trying to get out of there .. But Nada, would be happy to get any lead ..

OK, got your own solution 100% sure that there is a cleaner way, but ...

My app Can not use xpath supported by Square 8 (2.2) due to low levels of Android platform support

My solution Was not:

  public static string getTagValueWithMultiItem {Element Eilement} {String returnVal = ""; Node endod; Int NumOFItem = eElement.getElementsByTagName ("Link"). GetLength (); (Int y = 0; y & lt; NumOFItem; y ++) {eNode = eElement.getElementsByTagName ("link"). Item (y); Named attributes = eNode.getAttributes (); For (int g = 0; g; attributes.getLength (); g ++) {Attr attribute = (Attr) attributes.item (g); If (attribute.getNodeName (.) Equals ("rel") and attribute.getNodeValue (.) Equals ("optional")) {tryVal = eNode.getAttributes (). GetNamedItem ("href"). GetNodeValue (); } Hold (exception e) {returnVal = e.toString (); }}}} Return return value; }   

Any correction will be blessed

Comments