解析XML嵌入数据 [英] Parsing XML with embedded data

查看:203
本文介绍了解析XML嵌入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着去分析采用了android的XML。我的问题是,XML是在一个陌生的格式。数据我试图解析的整体位于一个元素里面。

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.

下面是一个例子:

<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>

该XML是一块从网页。我试图检索数据的&LT被发现;李&GT; 标签,特别是链接引用和漫画的名称。但我不知道我怎么会分开标题的链接。

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.

推荐答案

寻找它后,我发现在标签中的信息被称为属性(我是一个小白,我知道),并发现了一些谷歌搜索在 attributes.getvalue(这里的属性名称)的方法是什么,我一直在寻找。

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.

来源: XML解析得到属性值

这篇关于解析XML嵌入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆