Commit 04f4b8c5a81e17bd08494adfb0cd3da63683cece

Authored by Christian Herdtweck
1 parent d1c7e2ca

ooxml: do not warn if xml parse failure is expected

Showing 1 changed file with 7 additions and 3 deletions
oletools/ooxml.py
... ... @@ -290,9 +290,13 @@ class XmlParser(object):
290 290 assert(depth >= 0)
291 291 yield subfile, elem, depth
292 292 except ET.ParseError as err:
293   - logging.warning(' xml-parsing for {0} failed ({1}). '
294   - .format(subfile, err) +
295   - 'Run iter_non_xml to investigate.')
  293 + if subfile.endswith('.xml'):
  294 + logger = logging.warning
  295 + else:
  296 + logger = logging.debug
  297 + logger(' xml-parsing for {0} failed ({1}). '
  298 + .format(subfile, err) +
  299 + 'Run iter_non_xml to investigate.')
296 300 self.subfiles_no_xml.add(subfile)
297 301 assert(depth == 0)
298 302 if not args:
... ...