Question

I am building a python script to run nightly, part of which involves invoking a drupal bulk operation to export an XML file. Since the process takes a number of hours, and the next step is to automatically import it to another source, I would like to perform some level of integrity checking.

My first thought would be to simply make sure that the XML is not malformed. I don't particularly want to start inspecting the data, I just want to make sure it's not truncated.

What process might I use to perform this malformed check. Is there an applicable XML library built into Python? I would prefer to keep the script as portable as possible, so if possible a built-in solution would be the most preferable.

Thanks for any advice.

Was it helpful?

Solution

If you want use python, you can consider using element tree

Load your .xml and try to parse. Any Exception means XML is malformed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top