soco.xml module

This class contains XML related utility functions.

soco.xml.NAMESPACES = {'': 'urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/', 'upnp': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'dc': 'http://purl.org/dc/elements/1.1/', 'ms': 'http://www.sonos.com/Services/1.1', 'r': 'urn:schemas-rinconnetworks-com:metadata-1-0/'}

Commonly used namespaces, and abbreviations, used by ns_tag.

soco.xml.ns_tag(ns_id, tag)[source]

Return a namespace/tag item.

Parameters:
  • ns_id (str) – A namespace id, eg "dc" (see NAMESPACES)
  • tag (str) – An XML tag, eg "author"
Returns:

A fully qualified tag.

Return type:

str

The ns_id is translated to a full name space via the NAMESPACES constant:

>>> xml.ns_tag('dc','author')
'{http://purl.org/dc/elements/1.1/}author'