I have Python script to parse XML files into a more friendly format for another platform.
Every so often one of the data files contains no data - only the encoding info and no other tags, which is causing ElementTree to throw a ParseError when it finds them.
<?xml version="1.0" encoding="utf-8"?>
Is there a way of testing for the empty file before calling ElementTree?
Ta.
<character in data? if you find just 1 then file is probably empty.endswith("?>")?