[FIX] tools: ignore unknown entities while parsing

This commit is contained in:
Olivier Dony 2015-11-03 21:38:53 +01:00
parent 789a86901a
commit 051b2ce539
2 changed files with 7 additions and 1 deletions

View File

@ -1729,6 +1729,9 @@ class BaseModel(object):
fields = {}
children = True
if isinstance(node, SKIPPED_ELEMENT_TYPES):
return fields
modifiers = {}
def encode(s):

View File

@ -59,7 +59,10 @@ _logger = logging.getLogger(__name__)
# List of etree._Element subclasses that we choose to ignore when parsing XML.
# We include the *Base ones just in case, currently they seem to be subclasses of the _* ones.
SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.CommentBase, etree.PIBase)
SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.CommentBase, etree.PIBase, etree._Entity)
# Configure default global parser
etree.set_default_parser(etree.XMLParser(resolve_entities=False))
def find_in_path(name):
try: