Python 2.5: ElementTree and UML in XML

 ̄綄美尐妖づ 提交于 2019-12-02 05:14:12

register_namespace is only available since Python 2.7

There might be another way to preserve namespaces with ElementTree in 2.5, but I'm not aware of it.

Alternatively, you could try another parsing library. lxml preserves namespaces and its API is compatible with ElementTree.

see this page:http://effbot.org/zone/element-namespaces.htm

ElementTree 1.3 (Python 2.7)

ET.register_namespace(prefix, uri)

ElementTree 1.2 (Python 2.5)

ET._namespace_map[uri] = prefix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!