PHP 8.2.30
Preview: xinclude.pxi Size: 2.40 KB
//opt/hc_python/lib/python3.12/site-packages/lxml/xinclude.pxi

# XInclude processing

from lxml.includes cimport xinclude


cdef class XIncludeError(LxmlError):
    """Error during XInclude processing.
    """


cdef class XInclude:
    """XInclude(self)
    XInclude processor.

    Create an instance and call it on an Element to run XInclude
    processing.
    """
    cdef _ErrorLog _error_log
    def __init__(self):
        self._error_log = _ErrorLog()

    @property
    def error_log(self):
        assert self._error_log is not None, "XInclude instance not initialised"
        return self._error_log.copy()

    def __call__(self, _Element node not None):
        "__call__(self, node)"
        # We cannot pass the XML_PARSE_NOXINCNODE option as this would free
        # the XInclude nodes - there may still be Python references to them!
        # Therefore, we allow XInclude nodes to be converted to
        # XML_XINCLUDE_START nodes.  XML_XINCLUDE_END nodes are added as
        # siblings.  Tree traversal will simply ignore them as they are not
        # typed as elements.  The included fragment is added between the two,
        # i.e. as a sibling, which does not conflict with traversal.
        cdef int result
        _assertValidNode(node)
        assert self._error_log is not None, "XInclude processor not initialised"
        if node._doc._parser is not None:
            parse_options = node._doc._parser._parse_options
            context = node._doc._parser._getParserContext()
            c_context = <void*>context
        else:
            parse_options = 0
            context = None
            c_context = NULL

        self._error_log.connect()
        if tree.LIBXML_VERSION < 20704 or not c_context:
            __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context)
        with nogil:
            orig_loader = _register_document_loader()
            if c_context:
                result = xinclude.xmlXIncludeProcessTreeFlagsData(
                    node._c_node, parse_options, c_context)
            else:
                result = xinclude.xmlXIncludeProcessTree(node._c_node)
            _reset_document_loader(orig_loader)
        if tree.LIBXML_VERSION < 20704 or not c_context:
            __GLOBAL_PARSER_CONTEXT.popImpliedContext()
        self._error_log.disconnect()

        if result == -1:
            raise XIncludeError(
                self._error_log._buildExceptionMessage(
                    "XInclude processing failed"),
                self._error_log)

Directory Contents

Dirs: 4 × Files: 46

Name Size Perms Modified Actions
html DIR
- drwxr-xr-x 2025-04-04 08:01:59
Edit Download
includes DIR
- drwxr-xr-x 2025-04-04 08:01:59
Edit Download
- drwxr-xr-x 2025-04-04 08:01:59
Edit Download
- drwxr-xr-x 2025-04-04 08:01:59
Edit Download
62.12 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
113.80 KB lrwxr-xr-x 2025-04-04 08:01:59
Edit Download
7.91 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
21.91 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
8.26 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
3.23 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
3.21 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
5.64 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
17.32 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
14.92 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
8.36 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
5.11 MB lrwxr-xr-x 2025-04-04 08:01:59
Edit Download
9.68 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
131.36 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
16.66 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
31.34 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
16.13 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
9.68 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
16.67 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
8.92 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
2.94 MB lrwxr-xr-x 2025-04-04 08:01:59
Edit Download
73.96 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
11.18 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
80.12 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
6.18 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
23.14 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
6.51 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
92 B lrw-r--r-- 2025-04-04 08:01:59
Edit Download
18.53 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
6.19 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
181.68 KB lrwxr-xr-x 2025-04-04 08:01:59
Edit Download
9.08 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
32.54 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
5.77 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
64.21 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
230 B lrw-r--r-- 2025-04-04 08:01:59
Edit Download
2.40 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
48.69 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
5.93 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
8.29 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
18.68 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
35.18 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
10.83 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
200.19 KB lrwxr-xr-x 2025-04-04 08:01:59
Edit Download
10.63 KB lrw-r--r-- 2025-04-04 08:01:59
Edit Download
574 B lrw-r--r-- 2025-04-04 08:01:59
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).