There are several possibilities to do this.
You can use for example the simplexml Framework.
For that you can try to create some classes which can help you to solve the issue.
UL class:
import java.util.ArrayList;
import java.util.List;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;
@Root(name = "ul", strict = false)
public class ULTag {
@ElementList(name = "li", inline = true, required = false)
List<LITag> liTags = new ArrayList<LITag>();
public List<LITag> getLiTags() {
return liTags;
}
public void setLiTags(List<LITag> liTags) {
this.liTags = liTags;
}
public ULTag() {
}
}
Li Class:
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
@Root(name = "li", strict = false)
public class LITag {
@Element(name = "strong", required = false)
private String strong;
public LITag() {
}
public String getStrong() {
return strong;
}
public void setStrong(String strong) {
this.strong = strong;
}
}
you can also create a strong class if you want to insert more things in it. but here we don't need it.
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
@Root(name = "strong", strict = false)
public class StrongTag {
@Element(name = "strong", required = false)
private String strong;
public StrongTag() {
}
public String getStrong() {
return strong;
}
public void setStrong(String strong) {
this.strong = strong;
}
}
Deserializing a simple object
Serializer serializer = new Persister();
File source = new File("yourxmlexampl.xml");
ULTag ulTag = serializer.read(ULTag.class, source);
Do what ever you want with ulTag. e.g.:
String percent=ulTag.getLITags().get(0).getStrong();
May be this can help you. Fill free to write me.
This is a link about simplexml framework
http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php