Android 解析 XML 来制作一棵树
我在android开发方面还不是很老,第一次使用XML解析我使用this 教程用于解析我想在树结构中读取的以下文件,我无法获得一些教程来解析我
<?xml version="1.0" encoding="UTF-8"?>
<Items>
<ItemData>
<title>Fruit</title>
<level>1</level>
<ItemData>
<title>Apple</title>
<level>2</level>
</ItemData>
<ItemData>
<title>Mango</title>
<level>2</level>
</ItemData>
<ItemData>
<title>Banana</title>
<level>2</level>
</ItemData>
</ItemData>
<ItemData>
<title>Vegitables</title>
<level>1</level>
<ItemData>
<title>carrot</title>
<level>2</level>
</ItemData>
<ItemData>
<title>spinach</title>
<level>2</level>
</ItemData>
</ItemData>
</Items>
只需要 的要求的文件指导和样本代码来实现我所需的功能。我将非常感激。
I am not very old in android development, for the first time I am using XML parsing I am using this tutorial for the parsing the following file that i want to read in a tree structure, I am not able to get some tutorial to parse the file of my requirements
<?xml version="1.0" encoding="UTF-8"?>
<Items>
<ItemData>
<title>Fruit</title>
<level>1</level>
<ItemData>
<title>Apple</title>
<level>2</level>
</ItemData>
<ItemData>
<title>Mango</title>
<level>2</level>
</ItemData>
<ItemData>
<title>Banana</title>
<level>2</level>
</ItemData>
</ItemData>
<ItemData>
<title>Vegitables</title>
<level>1</level>
<ItemData>
<title>carrot</title>
<level>2</level>
</ItemData>
<ItemData>
<title>spinach</title>
<level>2</level>
</ItemData>
</ItemData>
</Items>
I just need guidance and sample code to implement my required functionality. I shall be very grateful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,在这种情况下,我认为您可以使用以下解析器资源之一来查看工作示例:
希望以上有帮助。如果您发布一些您遇到的错误可能会有所帮助?
Well, in that case I think you can use one of the following parser resources to check out a working sample:
Hope above helps. It might help if you post some of errors you are facing?