[Simple-support] Serialization and namespace optimizations
Brought to you by:
niallg
|
From: bubbleguuum <bub...@fr...> - 2011-09-07 21:16:44
|
Hi,
I'm serializing namespace heavy data structures and there's a lot of redundency in the output as the namespace is specified for each element. For example:
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">
<item
id="T1020"
parentID="414">
<upnp:class xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">object.item.audioItem.musicTrack</upnp:class>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">2084</dc:title>
<upnp:albumArtURI
dlna:profileID="JPEG_TN"
xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"
xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/">http://1.2.3.4:9050/stream/99ae0c9ea500a4e4c41b4694e75380b5</upnp:albumArtURI>
<upnp:artist
role="Performer"
xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">Redshape</upnp:artist>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Redshape</dc:creator>
<upnp:genre xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">Techno</upnp:genre>
<upnp:originalTrackNumber xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">1</upnp:originalTrackNumber>
<dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006-01-02</dc:date>
<upnp:album xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">2084 / Ultra</upnp:album>
</item>
</DIDL-Lite>
The namespace if specified for each element that specify a @Namespace.
Is it possible to configure the serializer (or change the class definition) to put all namespaces at the root element like shown below:
<DIDL-Lite
xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"
xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/">
<item
id="T1020"
parentID="414">
<upnp:class>object.item.audioItem.musicTrack</upnp:class>
<dc:title>2084</dc:title>
<upnp:albumArtURI dlna:profileID="JPEG_TN">http://1.2.3.4:9050/stream/99ae0c9ea500a4e4c41b4694e75380b5</upnp:albumArtURI>
<upnp:artist role="Performer">Redshape</upnp:artist>
<dc:creator>Redshape</dc:creator>
<upnp:genre>Techno</upnp:genre>
<upnp:originalTrackNumber>1</upnp:originalTrackNumber>
<dc:date>2006-01-02</dc:date>
<upnp:album>2084 / Ultra</upnp:album>
</item>
</DIDL-Lite>
|