Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何从MiniDom元素中删除名称空间?_Python_Python 2.7_Minidom - Fatal编程技术网

Python 如何从MiniDom元素中删除名称空间?

Python 如何从MiniDom元素中删除名称空间?,python,python-2.7,minidom,Python,Python 2.7,Minidom,我有一个minidom对象,我需要将它保存到string中,但问题是每个元素都被一些名称空间包装,是否可以删除它?以下是我的例子: <Device:GetDeviceInformationResponse> <Device:Manufacturer>Pelco</Device:Manufacturer> <Device:Model>D5</Device:Model> <Device:FirmwareVers

我有一个minidom对象,我需要将它保存到string中,但问题是每个元素都被一些名称空间包装,是否可以删除它?以下是我的例子:

<Device:GetDeviceInformationResponse>
    <Device:Manufacturer>Pelco</Device:Manufacturer>
    <Device:Model>D5</Device:Model>
    <Device:FirmwareVersion>1.9.2.19-201</Device:FirmwareVersion>
    <Device:SerialNumber>AC</Device:SerialNumber>
    <Device:HardwareId>7006</Device:HardwareId>
</Device:GetDeviceInformationResponse>

考虑这一点:如果删除命名空间,XML的含义会发生变化。这是真的吗?类似:?@SimeonVisser抱歉,刚刚编辑了我的问题。