开发者

How to parse an Xml having two tags with same name

开发者 https://www.devze.com 2023-03-06 04:40 出处:网络
I am using SAX parser to get a data from XML. unfortunately i am having two tags with same name example <tags> <sam开发者_如何学Pythonetag>Abc</sametag> <sametag>Def</sameta

I am using SAX parser to get a data from XML. unfortunately i am having two tags with same name example <tags> <sam开发者_如何学Pythonetag>Abc</sametag> <sametag>Def</sametag ></tags>. so whenever i am parsing the file i only getting ABC the same tag which contains different data will never parse. if anyone having idea for to parse same name tags pls guide me to solve.


Simple XML Framework:

@Root(name = "tags")
class Tags {
    @ElementList(entry = "sametag", inline = "true")
    public ArrayList<String> sameTags;
}

I have totally not tested that code but you get the gist as to how easy it is to use. To see how to use it in Android take a look at my blog post.


Maybe this post could help you http://codeofaninja.blogspot.com/2011/05/android-how-to-parse-xml-file-and.html

0

精彩评论

暂无评论...
验证码 换一张
取 消