From 04f4b8c5a81e17bd08494adfb0cd3da63683cece Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Thu, 7 Dec 2017 11:29:37 +0100 Subject: [PATCH] ooxml: do not warn if xml parse failure is expected --- oletools/ooxml.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/oletools/ooxml.py b/oletools/ooxml.py index 1a863b4..133a671 100644 --- a/oletools/ooxml.py +++ b/oletools/ooxml.py @@ -290,9 +290,13 @@ class XmlParser(object): assert(depth >= 0) yield subfile, elem, depth except ET.ParseError as err: - logging.warning(' xml-parsing for {0} failed ({1}). ' - .format(subfile, err) + - 'Run iter_non_xml to investigate.') + if subfile.endswith('.xml'): + logger = logging.warning + else: + logger = logging.debug + logger(' xml-parsing for {0} failed ({1}). ' + .format(subfile, err) + + 'Run iter_non_xml to investigate.') self.subfiles_no_xml.add(subfile) assert(depth == 0) if not args: -- libgit2 0.21.4