I have an xml similar to following
<Data1 profiles="urn:mpeg:dash:profile:isoff-live:2011,urn:com:dashif:dash264,urn:hbbtv:dash:profile:isoff-live:2012">
<MediaName src="abc.mpd" name="abc" type="dash"/>
</Data1>
I am converting this xml to object using object mapper
objectMapper.readValue(inputStream, Data1.class);
Following is my Data1 class;
public class MediaName {
public String src;
public String name;
public String type;
}
@JacksonXmlRootElement(localName = "Data1", namespace = Data1.NAMESPACE)
public class Data1 {
@JacksonXmlProperty(localName = "MediaName", namespace = NAMESPACE)
public MediaName MediaName;
@JacksonXmlProperty(isAttribute = true)
public List<Profile> profiles;
}
public enum Profile {
MPEG_DASH_FULL("urn:mpeg:dash:profile:full:2011"),
MPEG_DASH_ON_DEMAND("urn:mpeg:dash:profile:isoff-on-demand:2011"),
MPEG_DASH_LIVE("urn:mpeg:dash:profile:isoff-live:2011"),
MPEG_DASH_MAIN("urn:mpeg:dash:profile:isoff-main:2011"),
MPEG_DASH_MP2TS("urn:mpeg:dash:profile:mp2t-main:2011"),
MPEG_DASH_MP2TS_SIMPLE("urn:mpeg:dash:profile:mp2t-simple:2011"),
MPEG_DASH_3GP("urn:3GPP:PSS:profile:DASH10"),
HBBTV201("urn:dvb:dash:profile:dvb-dash:2014"),
HBBTV15("urn:hbbtv:dash:profile:isoff-live:2012");
private final String identifier;
Profile(String identifier) {
this.identifier = identifier;
}
@Override
public String toString() {
return identifier;
}
public static Profile fromIdentifier(String identifier) {
for (Profile profile : values()) {
if (profile.identifier.equals(identifier)) {
return profile;
}
}
throw new IllegalArgumentException();
}
}
I am performing some operation on MediaName tag and modifying it and converting it back to Data1 xml. For same I am using ObjectMapper.
objectMapper.writeValueAsString(data1);
but after conversion xml unexpected as follows:
<Data1 profiles="MPEG_DASH_LIVE" profiles=“HBBTV15“>
<MediaName src=“http://domainchange.com/abc.mpd" name="abc" type="dash"/>
</Data1>
expected is:
<Data1 profiles="urn:mpeg:dash:profile:isoff-live:2011,urn:com:dashif:dash264,urn:hbbtv:dash:profile:isoff-live:2012">
<MediaName src="https://domainchange.com/abc.mpd" name="abc" type="dash"/>
</Data1>
Please help understanding how to achieve the expected output.