Parsing XML feed die with "Element is already used" Parsing XML feed die with "Element is already used" xml xml

Parsing XML feed die with "Element is already used"


This fixes the problem:

Remove this:

@Element(name = "title", required = false)

Replace with:

//inside the inner class RssItem@Path("title")@Text(required=false)public String title = "";

This should be repeated for any other field that gets the exception.


It appears that using

@Element(name = "title", required = false, inLine=true)public String title = "";

will solve your problem, as shown here.


There are two title elements in your XML file. The first title element is in channel tag and the other title element is in item tag. so you should specify to the parser that the paths for these titles are different. do that in the following way:

Edit this:

@Element(name = "title", required = false)public String title = "";

Add Path Annotation:

@Element(name = "title", required = false)@Path('rss/channel')public String title = "";

here you specified for the title in channel tag that this is your path. the other title differs from you :)