在我的代码中,我正在使用 Python 中的 ElementTree 以预定义格式更改 XML 中现有的格式化字符串。
<Value xsi:type='xs:string'>{"name":"Test123","type":"}</Value>
新文本添加者:ValueNode.text = '{"name":"NewTextdemo"}'
并保存我正在使用的文件doc.write(path_to_XML_file)
问题是,doc.write(path_to_XML_file)
正在将实体名称更改"
为&quot;
进一步的实体名称 - 因此结果 XML 无效。
有人知道如何避免吗?如何设置写入功能以省略这些特殊字符?
谢谢