Question

I'm using Simple Xml Serialization library http://simple.sourceforge.net/

I have no problem parsing various feeds for my projects, except for one, which has a duplicate tag. Probably a web developer's error.

I have to parse something similar to this:

<item>
 <name>
 <description>
 <location>
 <url>
 <location>
 <image>
</item>

This is just an example. In this case the 'location' tag is repeating. This causes the parsing to stop. Is there any way to parse this xml using Simple library?

EDIT: I tried building my object class like this, but it didn't work:

@Element(name="name")
private String name;

@Element(name="description")
private String description;

@Element(name="location")
private String location;

@Element(name="url")
private String ur;

@Element(name="location")
private String location2;

@Element(name="image")
private String image;
Was it helpful?

Solution

sorry haven't used it..

but by looking at the examples and documents..

you could try

item/location[1]

and

item/location[2]

for each one?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top