VilemRousi
VilemRousi

Reputation: 2142

ElementTree's .write() changes strings with " to "

In my code, I am changing an existed formatted string in XML with predefined format with ElementTree in Python.

<Value xsi:type='xs:string'>{&quot;name&quot;:&quot;Test123&quot;,&quot;type&quot;:&quot;}</Value>

New text adding by: ValueNode.text = '{&quot;name&quot;:&quot;NewTextdemo&quot;}'

and to save the file I am using doc.write(path_to_XML_file)

The problem is, that the doc.write(path_to_XML_file) is changing the &quot; to &amp;quot; further entity name - and so the result XML is invalid.

Does anybody know how to avoid it? How to set write function to omits conding these special characters?

Thank you

Upvotes: 0

Views: 892

Answers (0)

Related Questions