1 from xml
.dom
import minidom
2 from zeroinstall
.injector
import namespaces
3 from zeroinstall
.zerostore
import manifest
, Stores
, NotStored
5 from logging
import info
10 doc
= minidom
.parseString(data
)
13 for archive
in doc
.documentElement
.getElementsByTagNameNS(namespaces
.XMLNS_IFACE
, 'archive'):
14 href
= archive
.getAttribute('href')
15 type = archive
.getAttribute('type')
18 if href
.endswith('.tar.bz2'):
19 type = "application/x-bzip-compressed-tar"
20 elif href
.endswith('.tgz') or href
.endswith('.tar.gz'):
21 type = "application/x-compressed-tar"
23 raise Exception("Can't guess type for " + href
)
24 archive
.setAttribute('type', type)
28 return doc
.toxml('utf-8')