Я использую SimpleXML
прилагается к Retrofit
. Мой вопрос XML выглядит следующим образом:Android - простой синтаксический анализатор пар, чтобы игнорировать элементы?
<item id="1-22-33-55" parentID="1" restricted="1">
<res protocolInfo="http-get:*:video/mpeg:*">http://<blablahere>/slash/slash</res>
<upnp:callSign>Channel</upnp:callSign>
<upnp:channelID type="ANALOG">1</upnp:channelID>
<upnp:channelID type="DIGITAL">1,0</upnp:channelID>
<upnp:channelID type="SI">1,1019,10301</upnp:channelID>
<upnp:channelID type="UNIVERSAL">578865282</upnp:channelID>
<upnp:class>object.item.videoItem.videoBroadcast</upnp:class>
<dc:title>Channel</dc:title>
</item>
Но, я не хочу, чтобы разобрать callSign
. Если я намеренно ommit это от моего POJO, я получаю исключение:
org.simpleframework.xml.core.ElementException: Element 'callSign' does not have a match in class xxxxx.yyyyy.zzzzz.ContentDirectoryChannelItem at line 1
Есть ли способ определить, какой элемент конкретно игнорировать при разборе?
Мой POJO:
public class ContentDirectoryChannelItem {
@Attribute(name = "id")
private String chanId;
@Attribute(name = "parentID")
private String parentID;
@Attribute(name = "restricted")
private String restricted;
@ElementMap(entry = "channelID", key = "type", attribute = true, inline = true)
private Map<String, String> channelIDmap;
@Element(name = "class")// I want this out also !!!
private String upnpClass;
@Element(name = "title")
private String dcTitle;
@ElementMap(entry = "res", key = "protocolInfo", attribute = true, inline = true)
private Map<String, String> resourceMap;
}
Спасибо,