I have a following xml:
<Image>
<ImageUrl>url</ImageUrl>
<ImageType>type1</ImageType>
</Image>
Here Image Url is always going to be there in xml. But ImageType is optional field so I can get the following xml as well:
<Image>
<ImageUrl>url</ImageUrl>
</Image>
or something like this
<Image>
<ImageUrl>url</ImageUrl>
<CountryCode>01</CountryCode>
</Image>
Is there is easy way to read the xml such that I can have following:
Image {
String url;
Map<String, String> keyValue; // Key can be CountryCode/ImageType
}
Or there is some other data structure that can be populate dynamically without depending on the key. Usually I use jaxb for xml read/write. I am wondering if there is some library which can be used for aforementioned use case or may be jaxb as well.