java - Simple-Framework: Duplicate annotation (different namespace) -
i have rss feed i'd parse in java using simple framework. have problems 2 elements same name, 1 of them has namespace assigned. here example xml:
<?xml version="1.0" encoding="utf-8"?> <rss xmlns:dc="http://purl.org/dc/elements/1.1/"> <item> <title>regular titel</title> <dc:title>dc titel</dc:title> </item> </rss> currently item.class looks this:
@root public class item { @namespace(reference = "http://purl.org/dc/elements/1.1/", prefix = "dc") @element(name="title") public string dctitle; @element public string title; } this causes persistenceexception (duplicate annotation of name 'title' on field 'title'....), don't know how should this. please me figure out!
update
althought solution works, have problems serializing objects. namespaces, declare, not assigned elements in output xml.
try
@root public class item { @namespace(reference = "http://purl.org/dc/elements/1.1/", prefix = "dc") @path("title[1]") @text public string dctitle; @path("title[2]") @text public string title; }
Comments
Post a Comment