Skip to content

Commit

Permalink
Fixed issue where XML comments caused exceptions to be thrown. Fixes #64
Browse files Browse the repository at this point in the history
.
  • Loading branch information
Bryan Worrell committed Feb 25, 2014
1 parent 3b03c61 commit 40ec36e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions stix/utils/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ def parse_xml_to_obj(self, xml_file, check_version=True, check_root=True):
check_root -- Inspect the root element before parsing.
"""
tree = None
if check_version or check_root:
tree = etree.parse(xml_file)
parser = etree.ETCompatXMLParser(huge_tree=True)
tree = etree.parse(xml_file, parser=parser)

if check_version:
self._check_version(tree)
Expand All @@ -93,9 +92,8 @@ def parse_xml(self, xml_file, check_version=True, check_root=True):
check_root -- Inspect the root element before parsing.
"""
tree = None
if check_version or check_root:
tree = etree.parse(xml_file)
parser = etree.ETCompatXMLParser(huge_tree=True)
tree = etree.parse(xml_file, parser=parser)

if check_version:
self._check_version(tree)
Expand Down

0 comments on commit 40ec36e

Please sign in to comment.