Hi all,
I have a machine that is controlled with xml messages.
After forming a message, I send send it to the machine like this:
response = system.net.httpPost(URL, "text/xml", message)
if I print the response, I get this:
<?xml version="1.0" encoding="utf-8"?>
<response>
<fault>
<code>1002</code>
</fault>
</response>
I would like to parse this string as described here: Parsing XML with the Etree Library - Ignition User Manual 8.0 - Ignition Documentation
So I do this:
import xml.etree.ElementTree as ET
root = ET.fromstring(response)
Unfortunately it throws an error:
Traceback (most recent call last):
File "<input>", line 25, in <module>
File "C:\Users\bothad\.ignition\cache\gwmeisign1.meissner.com_8043\C0\pylib\xml\etree\ElementTree.py", line 1314, in XML
return parser.close()
File "C:\Users\bothad\.ignition\cache\gwmeisign1.meissner.com_8043\C0\pylib\xml\etree\ElementTree.py", line 1667, in close
self._raiseerror(v)
File "C:\Users\bothad\.ignition\cache\gwmeisign1.meissner.com_8043\C0\pylib\xml\etree\ElementTree.py", line 1519, in _raiseerror
raise err
File "<string>", line None
xml.etree.ElementTree.ParseError: Content is not allowed in trailing section.
Any ideas on how I can overcome this error?