RAAAAM
RAAAAM

Reputation: 3380

How to parse an Xml having two tags with same name

I am using SAX parser to get a data from XML. unfortunately i am having two tags with same name example <tags> <sametag>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.

Upvotes: 1

Views: 954

Answers (2)

Robert Massaioli
Robert Massaioli

Reputation: 13477

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.

Upvotes: 1

Kris
Kris

Reputation: 3769

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

Upvotes: 0

Related Questions