简体   繁体   中英

Parsing XML with embedded data

Im trying to parse an XML using android. My problem is that the XML is in a strange format. The entirety of the data I'm trying to parse is located inside one element.

Here is an example:

<a name="3"></a>
<div class="series_alpha">
<h2 class="series_alpha"><a href="#top">3</a></h2>
<ul class="series_alpha"><li><a href="/3-banme-no-kareshi">3 Banme no        Kareshi</a><span class="mangacompleted">[Completed]</span></li>
<li><a href="/1074/3-gatsu-no-lion.html">3 Gatsu no Lion</a></li>
<li><a href="/990/337-byooshi.html">337 Byooshi</a></li>
<li><a href="/360-degrees-material">360 Degrees Material</a></li>
<li><a href="/37-degrees-kiss">37 Degrees Kiss</a><span class="mangacompleted">[Completed]</span></li>
<li><a href="/184/3x3-eyes.html">3x3 Eyes</a></li>
</ul>
<div class="clear"></div>
</div>

The XML is a piece of the source from this webpage. The data I'm trying to retrieve is found in the <li> tag, specifically the link reference and Manga name. But I dont know how I would separate the link from the title.

After looking it up I found the information inside the tags is known as an "attribute" (I'm a noob i know) and with some google searches found the attributes.getvalue("name of attribute here") method is what I was looking for.

source: XML Parsing to get Attribute Value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM