I have an xml
that I parsed with objectify from an API output and i refer to it as "result" variable. Now I want o keep the object, but only change the text file and give it back to the API to update the element.
<field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="multi_text_area">
<id>1754</id>
<name>Devices under maintenance</name>
<read_only>false</read_only>
<text_area>
<text>defwhanld12x</text>
</text_area>
</field>
When I try to change the text I get like this, I get an error:
result.text_area.text = 'This is a test'
TypeError: attribute 'text' of 'ObjectifiedElement' objects is not writable
I also tried to strip the element and recreate it as the lxml
documentation says that you can not change an object.
etree.strip_elements(result, 'text')
etree.SubElement(result.text_area, 'text').text = 'This is just a test'
But get a similar error:
TypeError: attribute 'text' of 'StringElement' objects is not writable