1
<?xml version="1.0"?> <list xmlns="http://namespace"> <imageList>img1</imageList> <imageList>img2</imageList> <imageList>img3</imageList> <imageList>img4</imageList> <imageList>img5</imageList> <imageList>img6</imageList> </list> 

i have xml with content like this (not real just for discribe my problem)

want to parse it via simpleframevork to something like List<String>

but everything what i tryed before throws exceptions

my class for parsing

@Root(strict = false) public class List { @ElementList(entry = "imageList", type = String.class, empty = false) public ArrayList<String> images; public ArrayList<String> getImages() { return images; } } 

and i recieve exception

Caused by: org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(entry=imageList, data=false, inline=false, name=, type=class java.lang.String, required=true, empty=false) on field 'images' public java.util.ArrayList ru.cian.qa.pojo.List.images for class ru.cian.qa.pojo.List at line 2 

1 Answer 1

1

parametr inline = true is solve my problem

working code here

@Root(strict = false) public class ImagesList { @ElementList(entry = "imageList", inline = true) private List<String> images; public List<String> getImages() { return images; } } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.