Parsing XML return from get_report() call

After spending way too much time on this, I think i have found that the return from the get_report() call is not XML compliant. THe problem is that the value of the is not explicitly tagged, and follows several embedded elements within the report element. I am not an XML expert, to say definitively, but all the parsers I tried parsed the tree, but not the value. I added a regex to put tags in, and everything worked fine.

Can anyone confirm if the reply is XML compliant or not?

I suppose you have an issue with something like this

<foo>some text

and want to get some text.

This may be a bit difficult in some XML libraries. E.g. with Python etree you need to use a special method itertext.


I am really sure all generated responses are valid XML.

1 Like

Thank you, I patched my own way around it, but I prefer not to do that, so this is great information.

I tried to use the itertext() function, and ran into another problem. Getting the CSV version, at least, returns a ‘name’ value as well, which then throws off the base64 decoding. Adding a ‘value’ tag makes the whole thing a lot easier to manage. I am doing it by regex, but I really think it should be fixed in the interface code.

Without knowing the exact XML and your use case I am not able to give further advises. Of course with a sub element it would be easier to parse but python etree should provide you with all necessary tools.