diff options
-rw-r--r-- | CHANGES.txt | 3 | ||||
-rw-r--r-- | src/lxml/ElementInclude.py | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 4683d096..3e57a5a2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,9 @@ under development Features added -------------- +* ElementInclude module for ElementTree compatible XInclude processing that + honours custom resolvers registered with the source document + * ElementTree.parser property holds the parser used to parse the document * setup.py has been refactored for greater readability and flexibility. diff --git a/src/lxml/ElementInclude.py b/src/lxml/ElementInclude.py index 6a449a5d..193c4535 100644 --- a/src/lxml/ElementInclude.py +++ b/src/lxml/ElementInclude.py @@ -186,9 +186,11 @@ def _include(elem, loader=None, _parent_hrefs=None): "unknown parse type in xi:include tag (%r)" % parse ) elif e.tag == XINCLUDE_FALLBACK: - raise FatalIncludeError( - "xi:fallback tag must be child of xi:include (%r)" % e.tag - ) + parent = e.getparent() + if parent is not None and parent.tag != XINCLUDE_INCLUDE: + raise FatalIncludeError( + "xi:fallback tag must be child of xi:include (%r)" % e.tag + ) else: raise FatalIncludeError( "Invalid element found in XInclude namespace (%r)" % e.tag |