From dae3f0f30f7b35912252c4d9a43e2ccd96ac36d7 Mon Sep 17 00:00:00 2001 From: Etienne Stalmans Date: Mon, 23 Oct 2017 21:26:44 +0200 Subject: [PATCH] clean-up to use TAG_W_INSTRATTR instead of constructing string during parsing --- oletools/msodde.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oletools/msodde.py b/oletools/msodde.py index 80f9443..fd121b2 100644 --- a/oletools/msodde.py +++ b/oletools/msodde.py @@ -81,6 +81,7 @@ NS_WORD = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main' # XML tag for 'w:instrText' TAG_W_INSTRTEXT = '{%s}instrText' % NS_WORD TAG_W_FLDSIMPLE = '{%s}fldSimple' % NS_WORD +TAG_W_INSTRATTR= '{%s}instr' % NS_WORD # === FUNCTIONS ============================================================== @@ -115,7 +116,7 @@ def process_file(filepath): for elem in root.iter(TAG_W_FLDSIMPLE): # concatenate the attribute of the field, if present: if elem.attrib is not None: - text += elem.attrib['{http://schemas.openxmlformats.org/wordprocessingml/2006/main}instr'] + text += elem.attrib[TAG_W_INSTRATTR] return text -- libgit2 0.21.4