<feed xmlns="http://www.ixtens.com/xml/mp/override/R1.1“ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“ xsi:schemaLocation=”http://www.ixtens.com/xml/mp/override/R1.1 http://support.ixtens.com/mp/R1.1/product/override.xsd">
…
Данные
…
</feed>
Делаю
import lxml.etree xmlns = "http://www.ixtens.com/xml/mp/override/R1.1" xmlns_xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi_schemaLocation = "http://www.ixtens.com/xml/mp/override/R1.1 http://support.ixtens.com/mp/R1.1/product/override.xsd" NSMAP = {None: xmlns} new_feed = lxml.etree.Element('feed', nsmap=NSMAP) new_feed = lxml.etree.Element('feed') new_feed.set('xmlns', xmlns) head = lxml.etree.SubElement(new_feed, 'data') new_feed.set('{http://www.ixtens.com/xml/mp/override/R1.1}xsi', xmlns_xsi) new_feed.set('{http://www.w3.org/2001/XMLSchema-instance}schemaLocation', xsi_schemaLocation) print(lxml.etree.tostring(new_feed, pretty_print=True, encoding='utf-8', xml_declaration=True))
Получаю
<?xml version='1.0' encoding='utf-8'?>
<feed xmlns:ns0="http://www.ixtens.com/xml/mp/override/R1.1“ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“ xmlns=”http://www.ixtens.com/xml/mp/override/R1.1“ ns0:xsi=”http://www.w3.org/2001/XMLSchema-instance“ xsi:schemaLocation=”http://www.ixtens.com/xml/mp/override/R1.1 http://support.ixtens.com/mp/R1.1/product/override.xsd">
<data/>
</feed>
Как сгенерить правильное пространство имен?
UPD(05.02.2014): Ответили на Тостере